MSFN Forum: Send Keystrokes for automation (RunOnceEx, VBScr) - MSFN Forum

Jump to content


Unattended CD/DVD Guide Homepage · MSFN Forum Rules

Welcome to the Applications Installs forum. Make sure you read the forum rules before you start posting.

Links/Requests to warez and/or any illegal material (porn, cracks, serials, etc..) will not be tolerated. Discussion of circumventing WGA/activation/timebombs/keygens or any other illegal activity will also not be tolerated.

We try our best to keep this forum clean of illegal content. If you see any illegal activity use the "report" button you find in every post to report the specific post to the moderators. If you ignore any of the rules you will be banned without notice.

Read Forum Rules
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Send Keystrokes for automation (RunOnceEx, VBScr) Send keys to a window (with time limit) Rate Topic: -----

#1 User is offline   ShaikJawad 

  • Newbie
  • Group: Members
  • Posts: 16
  • Joined: 04-January 04

  Posted 04 January 2004 - 03:44 AM

Hi all,

Happy New Year everyone! I hope this is the right spot to post a script I created to automate sending key strokes to an application during unattended install... I created my first Multi-Boot DVD... its awesome!!! I'll post all my menu screens I created (using photoshop). I used EasyBoot for the menu creation and UltraISO for the bootable ISO. The DVD has all my Operating Systems from Windows 1.0 to Windows XP, **** Small Linux, FreeDOS and Recovery Utils :-). Check out my upcoming posts. Good luck on your un-attendables :)


The visual basic script below will send keystrokes to any window (after finding it and making it active). You can call it from your RunOnceEx.cmd file as follows:



This is an example using Ad-Aware Pro 6:

REM ***TITLE***
REG ADD %KEY%\9970 /VE /D "Lavasoft Ad-Aware Pro" /f

REM ***Install Ad-Aware Pro***
REG ADD %KEY%\9970 /V 1 /D "%systemdrive%\install\Ad-AwarePro.exe /s" /f

REM ***Send Password using the script***
REG ADD %KEY%\9970 /V 2 /D "%systemdrive%\install\SendKeys.vbs \"Password\" \"0000000{ENTER}\" 30 500" /f


Replace 0000000 with your Password!




Here is the text of the script, I will attach a zip file of the .vbs and some very good documentation on RunOnceEx with examples from Microsoft.





'***********************************************************
'Title   : SendKeys.vbs
'Author  : Jawad Shaik Mohammed (shaikjawad@yahoo.com)
'Date    : 4-Jan-2004
'QuikInfo:
'          Waits & Looks for a Window by its title,
'          If found (in the allotted time), sends
'          any Key sequence to window and exit.
'***********************************************************
'***************HAPPY NEW YEAR EVERYONE!!!******************
'***********************************************************
'Description:
'Waits for the window "WindowName" to appear and send "Keys"
'Script Calling Syntax:
'SendKeys.vbs "Window Title (Exact, First few, Last few)" "Keys to send"
'             "# of times to loop" "Wait time(milli) for each loop"
'
'
'Example for Ad-Aware Pro 6:
'
'SendKeys.vbs  "Password" "0000000{ENTER}" 30 500
'
'The above command line will start this script and run it until
'the window titled "Password" shows up OR until 30 cycles of
'0.5 seconds each (15 sec), which ever comes first. If successful,
'script will activate the window and send 0000000 and the ENTER key
'to it.
'***********************************************************

Option Explicit
'On Error Resume Next

Dim WshShell, Args, WindowName, Keys, LoopTimes, LoopWaitTime
Set WshShell = WScript.CreateObject("WScript.Shell")
Set Args = WScript.Arguments
If Args.Count <> 4 Then
  MsgBox "Wrong number of arguments supplied. " & Args.Count &_
         " Correct Syntax is : " & vbCrLf &_
         "SendKeys.vbs <Window Name> <Keys> <Times to loop> <Wait time for each loop>"
  WScript.Quit 999
End If

WindowName = Args(0)
Keys = Args(1)
LoopTimes = Args(2)
LoopWaitTime =  Args(3)
Call LookForWindow()
WshShell.SendKeys Keys
Set WshShell = Nothing


Sub LookForWindow()
  Do Until WshShell.AppActivate(WindowName)
    If LoopTimes < 1 Then
      WScript.Quit 999
    End If
    WScript.Sleep LoopWaitTime
    LoopTimes = LoopTimes - 1
  Loop
End Sub

**********************************************




The attached zip file contains SendKeys.vbs, Reg.exe documentation, and RunOnceEx,cmd sample file with very helpful samples. Email me if you are having any trouble. Look for my menus and tricks I used for my boot DVD on my next post, hopefully sometime this week. Good luck all.

Attached File(s)




#2 User is offline   ShaikJawad 

  • Newbie
  • Group: Members
  • Posts: 16
  • Joined: 04-January 04

Posted 04 January 2004 - 03:53 AM


check it out! my first post and its 1/4/04/ 4:44am lol :)


#3 User is offline   devil270975 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 368
  • Joined: 31-July 03

Posted 04 January 2004 - 09:16 AM

I think you will find there is already a guide to this and i believe it is in a sticky thread called threads of interest - b0r3rd & westi VBS Scripts

#4 User is offline   ShaikJawad 

  • Newbie
  • Group: Members
  • Posts: 16
  • Joined: 04-January 04

Posted 04 January 2004 - 02:15 PM

You are right... the send keys script here (http://www.MSFN.org/...sti+VBS+Scripts) does just about the same thing, though mine is more generic and can be used for any key/any application with a time limit. Thanks for pointing it out dev.

#5 User is offline   XL-DJK 

  • XL-DJK Recordings Inc.2010 All Rights Reserved
  • PipPip
  • Group: Members
  • Posts: 249
  • Joined: 13-November 03
  • OS:none specified
  • Country: Country Flag

  Posted 04 January 2004 - 02:40 PM

:) That's very clever of you, and I can guarantee you that all of us here at MSFN are going to make great use of this.....keep up the excellent work! :rolleyes:

#6 User is offline   mazin 

  • MSFN Addict
  • Group: Supreme Sponsor
  • Posts: 1,952
  • Joined: 12-January 04

Posted 22 July 2004 - 03:04 AM

ShaikJawad

Would you please post your menu screens?

Also, I want to use EasyBoot. Would you please give me some idea about that?

I have got version 5, now.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy