I current have a vbscript section of my macro that is intended to press AltF and then press x to exit the screen. When testing, sometimes it closes the screen and sometimes the X is not triggered. Is there a different way to configure this send key?
ws.SendKeys "%{F}"
ws.SendKeys "x"
Send Keys question
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Why are you doing that with VBScript. The best way would just be:
Press Alt
Send>fx
Release ALT
Split the f and x up if needed, or move the x outside the alt (all apps work differently) and insert a wait if needed. E.g.
Press Alt
Send>f
Release Alt
Wait>0.5
Send>x
Press Alt
Send>fx
Release ALT
Split the f and x up if needed, or move the x outside the alt (all apps work differently) and insert a wait if needed. E.g.
Press Alt
Send>f
Release Alt
Wait>0.5
Send>x
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
VB Script
Hello.
The reason the commands were in vbscript is because I needed to reactivate a window so I could close the program with the commands. I was using the appactivate command in vbscript to do this.
This is the whole vbscript function:
Function CloseApps
Dim ws
Set ws = CreateObject( "WScript.Shell" )
ws.AppActivate "Session"
Wscript.sleep 2000
ws.SendKeys "{F3}"
Wscript.sleep 2000
ws.SendKeys "90"
Wscript.sleep 2000
ws.SendKeys "{Enter}"
Wscript.sleep 1000
'ws.SendKeys "%{F}"
'ws.SendKeys "x"
The reason the commands were in vbscript is because I needed to reactivate a window so I could close the program with the commands. I was using the appactivate command in vbscript to do this.
This is the whole vbscript function:
Function CloseApps
Dim ws
Set ws = CreateObject( "WScript.Shell" )
ws.AppActivate "Session"
Wscript.sleep 2000
ws.SendKeys "{F3}"
Wscript.sleep 2000
ws.SendKeys "90"
Wscript.sleep 2000
ws.SendKeys "{Enter}"
Wscript.sleep 1000
'ws.SendKeys "%{F}"
'ws.SendKeys "x"
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You don't need to use VBScript to activate a window. Just use the SetFocus command. E.g.:
SetFocus>Session
Wait>1
Press F3
Wait>2
Send>90
etc
SetFocus>Session
Wait>1
Press F3
Wait>2
Send>90
etc
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?