How to click 'yes' on pop up

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
catbox
Junior Coder
Posts: 26
Joined: Mon Dec 03, 2012 6:43 pm

How to click 'yes' on pop up

Post by catbox » Wed Mar 05, 2014 5:25 pm

I have a simple script that opens an application, navigates to a screen, checks a box and then clicks save...a pop-up pops to warn about saving and I click yes to finish.

The code is working fine if I am logged into the PC, but once I turn on automation and run the scheduled script - it is not moving from the save to the confirm pop-up.

This is what I am using to click save on the screen, then yes on the pop-up:

Code: Select all

SetFocus>
    CapsOff
    Press LCTRL
    Press LALT
    Wait>0.4
    Send>s
    Wait>0.4
    Release ALT
    Wait>7.08
    Press LALT
    Wait>0.3
    Send>y
    Wait>3
    Release ALT

originally, I was using an IEClickTag to click the first Save, but I wasn't able to move into the pop-up to click Yes.

Since this script is mimicing a user clicking throught the GUI interface...it may not be possible to do this?

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Wed Mar 05, 2014 11:40 pm

Try set focus first to select the prompt.
FIREFIGHTER

catbox
Junior Coder
Posts: 26
Joined: Mon Dec 03, 2012 6:43 pm

Not resolved

Post by catbox » Thu Mar 06, 2014 12:41 pm

Yes, I do set focus.... and the script works fine - as long as you are logged into the PC. Once you click to use the autologon feature, the script goes thru to the Save box, and where it need to Save and click Yes.

I guess you cannot use keyboard commands in scripts with the autologon feature.

I just found this:
2. If you are running Vista/Windows7/2008 Server you can use Macro Scheduler’s AutoLogon system. See under Macro Properties. This will log Windows back in on schedule, run the macro, and then log out again

I am running Windows 7 and this feaure isn't working w/ autologon.

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

Post by Marcus Tettmar » Thu Mar 06, 2014 4:02 pm

You *CAN* use keyboard commands along with AutoLogon. AutoLogon works by logging onto Windows (or unlocking it) and THEN running the script. If the window you want to interract with is present after log on you should then be able to control it.

You may need to insert a delay to give the system a chance to settle down and to make sure the window is present.

I would also use IfWindowOpen or WaitWindowOpen to ensure the window is present and ready.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

catbox
Junior Coder
Posts: 26
Joined: Mon Dec 03, 2012 6:43 pm

Script only runs partially

Post by catbox » Thu Mar 06, 2014 7:03 pm

Yes, The Autologon does run, but the keyboard commands do not execute (the IEClicks do).

Actually, when I set the report to run...the computer doesn't physically log into the desktop (should it?)....I see the mouse flicker at the start time...when I log back into Windows, the script completes up to the 'Save' and 'Okay' commands...all of the IEClicks work fine, it is the send text that do not....

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

Post by Marcus Tettmar » Thu Mar 06, 2014 7:21 pm

Yes, AutoLogon should physically log your machine on. You should see it log on.

If not, there's no way the key sends can work. IE commands can because they do not require a UI. They work by using IEs COM interface. There is no UI or console while Windows is locked. So you cannot simulate user input at that time.

If AutoLogon is not logging in check that it is installed properly. Run CRAutoLogon which you will find in the macro scheduler program folder.

Note we can't guarantee that AutoLogon works for everyone due to the limitless security permutations. It has been tested on vanilla windows installs but we cannot vouch for your system.

Here are some steps you can follow to check and test AutoLogon:

Please try these steps:

0. Make sure you have the very latest v14 release.

1. Make sure AutoLogon is installed:

1.1 Exit Macro Scheduler
1.2 Go to C:\Program Files (x86)\Macro Scheduler 14\ (or C:\Program Files\Macro Scheduler 14\ if on x86)
1.3 Right click on CRAutoLogon.exe and select Run as Admin
1.4 Follow the prompts to install AutoLogon.

2. Lets verify the components are present

2.1 You should see this file in C:\Windows\System32:
- mjtnet_cp.dll
2.2 In services (Control Panel/Administrative Tools/Services) you should see the following service which should be Started and set to Automatic.
- Macro Scheduler Service
2.3 Just for good measure you should also see these registry entries:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{80CA56E5-F41A-4309-8C37-D123C6F0CC6A}]

[HKEY_CLASSES_ROOT\CLSID\{80CA56E5-F41A-4309-8C37-D123C6F0CC6A}]
@="mjtnet"

[HKEY_CLASSES_ROOT\CLSID\{80CA56E5-F41A-4309-8C37-D123C6F0CC6A}\InprocServer32]
@="mjtnet_cp.dll"
"ThreadingModel"="Apartment"

If not we need to run the installer again or create manually.

3. Now we've verified that all the requisites are installed, let's do a test:

3.1 Start Macro Scheduler
3.1 Create a new macro - File New/Macro
3.2 Make it a simple one liner: MessageModal>Hi
3.3 Go into the AutoLogon tab and enter the username and password for the CURRENT USER profile - the one you are currently logged into.
3.4 Go into the Run When tab and check off ALL days and enter a start time, in 24 hour notation 2 MINUTES FROM NOW.
3.5 Save and close the macro
3.6 LEAVING Macro Scheduler running, LOCK the workstation (do not log off yet, just lock it). This can be done with Start button, then click the arrow to the right of Shut Down and then select Lock.
3.7 Wait, AT LEAST 2 minutes.
3.8 Windows should magically log in and run the macro - you'll see the message appear. Ok it and Windows will log out again.

Assuming that worked we can now test a LOGGED OUT scenario. Do the same but at 3.6 EXIT Macro scheduler and at 3.7 LOG OUT instead of lock. You might need longer than 2 minutes hence for the schedule as it can take a while to log out completely.

If after all this it hasn't worked then unfortunately we are out of options and we can only conclude AutoLogon won't work on your system. Could be due to a security config or other security software. We have tested and verified on vanilla, default Windows 7, Windows Vista, Windows 2008, Windows 8 and Windows 2012 setups, both x86 and x64. We cannot vouch for or support unusual configs or any that use alternative or locked down security policies. It also WILL NOT work on a virtual machine and will NOT work if you are running under a remote desktop session.
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
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Fri Mar 07, 2014 6:01 am

On a side note if your using this in a corporate environment with a login disclaimer that you must press ok to before you can login eg right after the CTRL + ALT + Del you have a disclaimer message and need to press ok to before the login prompt appears this will also cause it to fail. You need to have the disclaimer removed. Also if it's a corporate environment make sure your including the domain your logging into eg DOMAIN\USERNAME

As what Marcus has already said make sure you include some wait window open and then set focus commands. If it works while running normally your computer maybe is already in a ready state. When you first login you have services and applications that start in the background which may slow the computer down enough to affect the timing. This is why it's good to use if window open, wait window open and set focus prior to running commands as sometimes these apps running in the background can steal focus from the window your in.
FIREFIGHTER

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Mar 07, 2014 7:08 am

CyberCitizen wrote:On a side note if your using this in a corporate environment with a login disclaimer that you must press ok to before you can login eg right after the CTRL + ALT + Del you have a disclaimer message and need to press ok to before the login prompt appears this will also cause it to fail. You need to have the disclaimer removed.
Thanks CyberCitizen - That was exactly my issue, worked perfectly when Locked... but when Logged Out that pesky login disclaimer stopped it from working... so next step... getting it removed... wondering if this is something I can do myself... guessing its a registry entry... time to Google...

Yup... pretty easy... thanks again CyberCitizen!
http://www.howtogeek.com/howto/windows/ ... g-message/
Oh Oh... not so easy! While I was able to blank out the registry entries (including the group policy one mentioned)... unfortunately after a reboot... the Login Disclaimer is BACK IN PLACE!

Our corporate machines are also force-re-booted every 48 hours to ensure “stable operationâ€
Last edited by jpuziano on Tue Mar 11, 2014 3:18 pm, edited 2 times in total.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

catbox
Junior Coder
Posts: 26
Joined: Mon Dec 03, 2012 6:43 pm

Still not working

Post by catbox » Fri Mar 07, 2014 12:05 pm

I verified the program is installed on the PC's....

I am in a corporate environment (Window7 Professional/ AD logon acct w/ lots of group policies).... I am sure my AD account is loaded with tons of group policies. When the PC is locked, you can simply ctrl-alt-del to enter your password (no login disclaimer). There is an option to reset psw/change password at logon if you click (Ease of Access).

I have my username/domain set up in the autologon tab.

To test:
1. I schedule to run 4 minutes from now
2. I close my script
3. Minimize macroScheduler14.0.18
4. Lock the PC.

When the the script executes... I can see the mouse 'flash' on the logon screen telling me the script started, but the screen stays on the blued locked screen... I do not even see the ctrl-alt-delete when the password would be typed..... I then log into the PC and see the popup 'hello' box.

The problem may well be all of the group policies on my account. :(

I just tried the same simple script using the local user acct (which would have less security on it).... it failed to log onto the PC too.

This is the simple script I am using to test:

Code: Select all

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
MessageModal>Hello!!

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Sun Mar 09, 2014 12:27 pm

It sounds that the auto logon part still isn't installed correctly. Maybe try re-installing it again or do a complete reinstall, maybe try it on another computer to see if their is some strange going on with this install.

I would re-read Marcus's post & confirm that that all the requirements are their, have you installed the auto logon part in the program folder?
FIREFIGHTER

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