Thanks for your help Carrie. Someday I would like to learn VBscript. That
would help me do other stuff someday, without having to ask somebody to
write me another VBscript program.
In the mean time, I was looking for a Quick and Dirty 2-line .bat file.
Hope you don't mind me asking a dumb question. Realizing I don't understand
VBscript, is the 9-line program you provided better (e.g. more adaptable or
less breakable) than a 2-line .bat file would be ?
| | How can I add a line in a .bat file, that will send the <Enter> key ?
| <SNIP> What I'm trying to do is use the Startup folder to automatically
| Synchronize an Active Desktop item, by running a .bat file that runs
| Mobsync.exe, followed by sending an <Enter> keystroke. <SNIP>
You could use a VBS script that uses the SendKeys Method. For example,
copy the following lines of script into notepad, save it with the extension
..vbs, and then put a shortcut to the script in your Startup Folder.
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\WINDOWS\system32\Mobsync.exe"
WScript.Sleep 400
WshShell.AppActivate "Items to Synchronize"
WScript.Sleep 400
WshShell.SendKeys "{ENTER}"
REM WScript.Sleep 800
REM WshShell.SendKeys "%S"
Set WSHShell = Nothing
BTW, if you want to use the SendKeys command to close the dialog
box, just remove the REM from the script.
And if any of the processes need more or less time to execute before the
next
action is executed, increase or decrease the WScript.Sleep = value.
For some information about the WSH SendKeys Method see:
MSDN Home | MSDN Library | Web Development | Scripting | Windows
Script Technologies | Windows Script Host | Reference | Methods
Windows Script Host: SendKeys
http://msdn.microsoft.com/library/en-us/script56/html/wsMthSendKeys.asp
And for an offline version of the MSDN Library | Web Development |
Scripting | Windows Script Technologies Web Site pages visit the
following Microsoft Download Site and download scrdoc56en.exe. Then
double-click scrdoc56en.exe and it will prompt you for a location to
extract the Windows Script Technologies Help file (Script56.CHM)
Microsoft Windows Script 5.6 Documentation (scrdoc56en.exe)
http://www.microsoft.com/downloads/...48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en
And if you need any help with scripting try posting in the following
newsgroup: microsoft.public.scripting.vbs
If you read the newsgroups using the Microsoft Communities Web Page:
http://communities2.microsoft.com/c...t.aspx?dg=microsoft.public.scripting.vbscript
If you read newsgroups using a NNTP newsreader, such as Outlook
Express, and use the msnews.microsoft.com news server, here is a link:
news://msnews.microsoft.com/microsoft.public.scripting.vbs
Or if you insist on trying doing it with a bat I suggest that you post in
the
following newsgroup: microsoft.public.win2000.cmdprompt.admin
If you read the newsgroups using the Microsoft Communities Web Page:
http://communities2.microsoft.com/c...x?dg=microsoft.public.win2000.cmdprompt.admin
If you read newsgroups using a NNTP newsreader, such as Outlook
Express, and use the msnews.microsoft.com news server:
news://msnews.microsoft.com/microsoft.public.microsoft.public.win2000.cmdprompt.admin