unable to get focus on application and submit ALT + Y key

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
portabletelly
Newbie
Posts: 6
Joined: Mon Sep 28, 2015 3:57 am

unable to get focus on application and submit ALT + Y key

Post by portabletelly » Mon Sep 28, 2015 4:17 am

HI All,

First time poster, so anyway I've been mucking around with some macros to try and download a VPN client and install it. My script goes all the way and download loadoads the vpn client. It starts to run the EXE install it then I get stuck on a UAC Yes No question.

So I did some research and allot of forums are saying that you dont have permissions to run within UAC window unless you do a run as. Any way I think my issue is with focus not permission as I do a run as administrator or a local admin and i still cannot focus the UAC window.
Ive tried set focus
Wait window open
but nothing seems to work.

Can someone please give me an exmple how they would Wait until the window is open called User Account Control.
Then set its focus. Then Submit the ALT + Y to the User Account Control Box to select YES.
I spent about 4 hrs on it over the weekend and thru my hands up so your help would greatley be appreciated.

Code: Select all

Label>InstallWG
Message>now installing
wait>2
RunProgram>C:\Program Files (x86)\Internet Explorer\iexplore.exe https://mail.****:943/sslvpn.html
wait>5
IETagEventByAttrib>{"https://mail.***corp.com.au:943/sslvpn.html"},A,innertext=Continue to this website (not recommended).,click,
wait>4
IETagEventByAttrib>{"https://mail.***corp.com.au:943/sslvpn_logon.shtml"},INPUT,name=fw_username,,*****
wait>0.5
IETagEventByAttrib>{"https://mail.***.com.au:943/sslvpn_logon.shtml"},INPUT,name=fw_password,,******
wait>0.5
Press Tab *2
Wait>0.25
Press Enter
wait>5
SetFocus>User Authentication - Internet Explorer
CapsOff
wait>3
Press Tab
wait>1
Press Tab
wait>1
Press Tab
wait>1
Press Tab
wait>1
Press Tab
wait>1
Press Tab
wait>1
Press Tab
wait>1
Press Tab
wait>1
Press Tab
wait>1
Press Enter
wait>10
SetFocus>
CapsOff
Press ALT
Send>r
Wait>0.265
Release ALT
//put an if windows open hear later on
WaitWindowOpen>User Account Control
wait>0.5
Message>Script Does not have access to UAC so Press Yes
WaitWindowClosed>User Account Control
SetFocus>Setup - Mobile VPN with SSL client
Press Enter
Wait>0.5
Send>n
Wait>0.5
Release ALT



User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: unable to get focus on application and submit ALT + Y ke

Post by JRL » Mon Sep 28, 2015 1:30 pm

Its not a matter of focus, UAC has halted your script.

The method I posted inthis threadworked in my situation. Basically, dynamically create a script that you run prior to your install that waits for the UAC warning. The dynamically created script then responds to the UAC warning and your program continues.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: unable to get focus on application and submit ALT + Y ke

Post by Marcus Tettmar » Tue Sep 29, 2015 8:49 am

You can't/shouldn't automate UAC warnings. I'm not sure if JRL's method would work in every case. I'd be surprised as it somewhat negates the whole point of UAC.

If you need to automate something that requires Administrator privileges and you ARE an administrator then just run Macro Scheduler as admin in the first place and/or change your UAC settings so that you don't get the prompt.

Trying to automate across privilege levels is awkward.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: unable to get focus on application and submit ALT + Y ke

Post by JRL » Tue Sep 29, 2015 10:02 pm

Marcus is right. I've tried and have been unable to use the previously mentioned method to close the "User Account Control" window. I was using it before to close the "Open File - Security Warning" window which pops up if your try to run a program that is from an unknown publisher.

portabletelly
Newbie
Posts: 6
Joined: Mon Sep 28, 2015 3:57 am

Re: unable to get focus on application and submit ALT + Y ke

Post by portabletelly » Wed Sep 30, 2015 5:15 am

OK, so I worked out if you compile your script and run as admin the UAC doesn't come up. This may be a dumb question but ill ask anyway.

Is there a way when you are debugging/coding to runas admin without compliling the whole thing then doing a run as. For example i get to point in the script where I use the Debug step then press the green button. Is there a way to force it to run as admin when pressing the green button.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: unable to get focus on application and submit ALT + Y ke

Post by Marcus Tettmar » Wed Sep 30, 2015 9:04 am

Yes, run the FULL Macro Scheduler AS ADMIN. Then debug in the editor as normal.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts