VBScript Appactivate does not work when done in a Scheduled Task Windows 7 64
if i save the following code on my desktop on windows 7 64 bit and run it, it works fine:
Set Minshell = CreateObject("Shell.Application")
Minshell.MinimizeAll
set shell = createObject("wscript.shell")
nError =Shell.Run("%windir%\system32\notepad.exe",1)
Wscript.Sleep 5000
nError =shell.appactivate("Untitled - Notepad")
If nError Then
shell.SendKeys( "%fx" )
Else
msgbox "not activated - sleeping"
End if
It opens notepad, activates notepad, send an alt fx and closes notepad.
If you run this as a scheduled task, it still thinks it has activated notepad, but the send keys are not sent to notepad.
Any help would be appreciated,
Thank you in advance
bfanguybfanguy
November 4th, 2010 3:17pm
Hi,
Thanks for the post!
This Windows 7 forum is focused on answering usage-related questions about Windows 7, in order to resolve your problem efficiently, please ask this question in
Scripting Guys Forum.
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and
other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
Thanks for your understanding and cooperation!
Best Regards,
Miya Yao
This posting is provided "AS IS" with no warranties, and confers no rights. | Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer
your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
November 7th, 2010 9:22pm