Hi. I'm trying to learn vbs and get some basic things to work. I have two main questions right now concerning the script I've written, below:
1. I'm trying to write a simple script in notepad to automate the launching of an exe file (AcroRd32.exe). I've saved the file where the script is written as 1.vbs. When I launch the script, I get the error message: "The system cannot fine the file specified." I know that the exe file I'm attempting to launch is actually at the location I've put in the script. The only success I've had was launching things like Notepad.exe, Excel.exe and WinWord.exe, as listed in the FAQs of this forum. However, my goal is to be able to launch other executables as well. Can the WshShell.Run command not launch other types of exe files? If so, then how could I get the script to launch any executable file?
2. So, not getting the WshShell.Run "C:\Program Files\Adobe\Acrobat5.0\Reader\AcroRd32.exe" command to work, I commented out this line and launched AcroRd32.exe manually. Then the script seemed to be executing correctly, up until the point of the command: WshShell.Sleep 1000
I received the error message: "Object doesn't support this property or method: 'Sleep'
So, I'm not sure why these commands aren't working. Any help with these issues would be much appreciated. Thanks!
cold25
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe"
WshShell.AppActivate "Acrobat Reader"
WshShell.SendKeys "%{f}"
WshShell.SendKeys "{DOWN 8}"
WshShell.SendKeys "~"
WshShell.Sleep 1000
WshShell.SendKeys "%{f}"
WshShell.SendKeys "~"
1. I'm trying to write a simple script in notepad to automate the launching of an exe file (AcroRd32.exe). I've saved the file where the script is written as 1.vbs. When I launch the script, I get the error message: "The system cannot fine the file specified." I know that the exe file I'm attempting to launch is actually at the location I've put in the script. The only success I've had was launching things like Notepad.exe, Excel.exe and WinWord.exe, as listed in the FAQs of this forum. However, my goal is to be able to launch other executables as well. Can the WshShell.Run command not launch other types of exe files? If so, then how could I get the script to launch any executable file?
2. So, not getting the WshShell.Run "C:\Program Files\Adobe\Acrobat5.0\Reader\AcroRd32.exe" command to work, I commented out this line and launched AcroRd32.exe manually. Then the script seemed to be executing correctly, up until the point of the command: WshShell.Sleep 1000
I received the error message: "Object doesn't support this property or method: 'Sleep'
So, I'm not sure why these commands aren't working. Any help with these issues would be much appreciated. Thanks!
cold25
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe"
WshShell.AppActivate "Acrobat Reader"
WshShell.SendKeys "%{f}"
WshShell.SendKeys "{DOWN 8}"
WshShell.SendKeys "~"
WshShell.Sleep 1000
WshShell.SendKeys "%{f}"
WshShell.SendKeys "~"