shankhs Posted February 9, 2010 Share Posted February 9, 2010 Hi This is my second post in a day...I apologize if I am beaking any rules but I really wanna learn. I am following the tutorial given in the help file regarding installation of winZip.I am trying to automate the installation of notepad++. Here is my code ;Installation of npp Run("npp.5.6.4.Installer.exe") WinWaitActive("Open File - Security Warning","&Run") WinWaitActive("Installer Language","select a language") Send("{ENTER}") As you can see I am stuck at the language input stage , I cannot understand why its stuck...Moreover if I am pressing "enter" manually its running smoothly. One more problem , when the code is stuck at Language input stage I press "Cancel",the setup is exited but the program continues to run.How to safely abort the program using code written inside to handle such situations? Link to comment Share on other sites More sharing options...
acana007 Posted February 9, 2010 Share Posted February 9, 2010 just a hint that might help. if you go to where you installed autoit. if you browse the extras folder, in their is a folder called au3record. if you run that and install npp then take a look at the code that it gives you you might have an answer of what to do. Link to comment Share on other sites More sharing options...
PartyPooper Posted February 9, 2010 Share Posted February 9, 2010 As a general rules, whenever I need to interact with windows, I always set Opt("WinTitleMatchMode", ...) to whatever I need at the time. Link to comment Share on other sites More sharing options...
omikron48 Posted February 9, 2010 Share Posted February 9, 2010 I think the Security Warning dialog does not allow automated actions. Link to comment Share on other sites More sharing options...
987learner Posted February 9, 2010 Share Posted February 9, 2010 U can try to create a short delay before send "enter" key ;Installation of npp Run("npp.5.6.4.Installer.exe") WinWaitActive("Open File - Security Warning","&Run") Winwait ("Installer Language","select a language") Winactivate ("Installer Language","select a language") WinWaitActive("Installer Language","select a language") sleep (400); can set longer or shorter Send("{ENTER}") or you can also install silently using it's switch Runwait ("npp.5.6.4.Installer.exe /S") Link to comment Share on other sites More sharing options...
NerdFencer Posted February 9, 2010 Share Posted February 9, 2010 I think the Security Warning dialog does not allow automated actions.To evade this problem, add #RequireAdmin at the top of the script, and use ShellExecute instead of Run.The ShellExecute windows API transfers permission levels from the calling program to the called program when it runs. _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
shankhs Posted February 10, 2010 Author Share Posted February 10, 2010 just a hint that might help. if you go to where you installed autoit. if you browse the extras folder, in their is a folder called au3record. if you run that and install npp then take a look at the code that it gives you you might have an answer of what to do. AU3 Record is giving me this: _WinWaitActivate("Open File - Security Warning","The publisher could ") Send("{ALTDOWN}r{ALTUP}") _WinWaitActivate("Installer Language","Please select a lang") Send("{ENTER}") _WinWaitActivate("Notepad++ v5.6.4 Setup","Welcome to the Notep") Send("{ENTER}") _WinWaitActivate("Notepad++ v5.6.4 Setup ","Please review the li") Send("{ENTER}") _WinWaitActivate("Notepad++ v5.6.4 Setup ","Choose Install Locat") Send("{ENTER}") _WinWaitActivate("Notepad++ v5.6.4 Setup ","Choose which feature") Send("{ENTER}") _WinWaitActivate("Notepad++ v5.6.4 Setup ","Completing the Notep") Send("{SPACE}{ENTER}") which when I am trying to run gives me error: Unknown function name.: _WinWaitActivate("Open File - Security Warning","The publisher could ") ^ ERROR >Exit code: 1 Time: 0.991 Thnx PartyPooper for a useful advice I will keep it in mind from now on. Adding #RequireAdmin is forcing the installer to stuck in the security check only!!! I am trying a few more things here,in the meantime if you have any useful advice plz do tell me. Link to comment Share on other sites More sharing options...
shankhs Posted February 10, 2010 Author Share Posted February 10, 2010 Hi guys I was finally successful to write a script to install npp in its default directory,its a very simple script: ;Installation of npp Run("npp.5.6.4.Installer.exe") WinWaitActive("Installer Language") Sleep(400) Send("{ENTER}") WinWaitActive("Notepad++ v5.6.4 Setup") Sleep(400) Send("{ENTER}") WinWaitActive("Notepad++ v5.6.4 Setup") Sleep(400) Send("{ENTER}") WinWaitActive("Notepad++ v5.6.4 Setup") Sleep(400) Send("{ENTER}") WinWaitActive("Notepad++ v5.6.4 Setup") Sleep(400) Send("{ENTER}") Sleep(5000) WinWaitActive("Notepad++ v5.6.4 Setup") Send("{SPACE}{ENTER}") The main thing here is that no security check is met , so the script runs smoothly. Do you have any ways to check whether the window is for security check or not?mostly in Vistas where some prog give pop ups to "continue" or "cancel"... Please do suggest me ways other than that I wrote. Thank You shankhs Link to comment Share on other sites More sharing options...
omikron48 Posted February 10, 2010 Share Posted February 10, 2010 #RequireAdmin will make sure that the script has the proper administrator permissions before it will run. That should prevent UAC from prompting because of the script's actions. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now