themush1326 Posted December 18, 2006 Posted December 18, 2006 I am writing a script to install software on a group of about 100 PC's. The .exe the vendor provided must be run theu manually and has no install options. I have written a script that mimics the keystorkes but only works when the user is actively logged in. It doesnt work if the PC is locked or no one is logged in. Is there a way around this? I want to send this to the users when they arent there. thanks themush here is the code FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk1\Data1.cab","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk1\Data2.cab","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk2\Data3.cab","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk3\Data4.cab","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk4\Data5.cab","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk5\Data6.cab","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk1\Layout.bin","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk1\Setup.ini","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk1\Data1.hdr","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk1\ikernel.ex_","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk1\Setup.exe","C:\temp\",1) FileInstall("C:\DialerUpgrade\Interpreter\Magellan Interpreter\Disk Images\Disk1\Setup.inx","C:\temp\",1) FileInstall("C:\DialerUpgrade\Patches\Magellan.sll","C:\temp\",1) FileInstall("C:\DialerUpgrade\Patches\wkstnobs.dll","C:\temp\",1) BlockInput(1) Run('C:\temp\Setup.exe') Sleep(6000) WinWait("Confirm File Deletion","") If Not WinActive("Confirm File Deletion","") Then WinActivate("Confirm File Deletion","") WinWaitActive("Confirm File Deletion","") Send("{ENTER}") Sleep(1000) WinWait("Shared File Detected","") If Not WinActive("Shared File Detected","") Then WinActivate("Shared File Detected","") WinWaitActive("Shared File Detected","") Send("{ENTER}") Sleep(5000) Send("{ENTER}") Sleep(5000) Send("{ENTER}") Sleep(10000) WinWait("InstallShield Wizard","") If Not WinActive("InstallShield Wizard","") Then WinActivate("InstallShield Wizard","") WinWaitActive("InstallShield Wizard","") Send("{ENTER}") Sleep(1000) Run('C:\temp\Setup.exe') Sleep(6000) WinWait("InstallShield Wizard","") If Not WinActive("InstallShield Wizard","") Then WinActivate("InstallShield Wizard","") WinWaitActive("InstallShield Wizard","") Send("{ENTER}") Sleep(1000) Send("{ENTER}") Sleep(1000) Send("{ENTER}") Sleep(1000) Send("{ENTER}") Sleep(1000) Send("{ENTER}") Sleep(8000) FileCopy("c:\temp\Magellan.sll","c:\Program Files\Melita International\Magellan Interpreter\",1) FileCopy("c:\temp\wkstnobs.dll","c:\Program Files\Melita International\Magellan Interpreter\",1) Sleep(5000) BlockInput(0) Shutdown(5)
themush1326 Posted December 18, 2006 Author Posted December 18, 2006 experiment with controlclick and controlsendLAr.I'm a little confused on the syntax of this commandTo Send to a window titled "Confirm File Deletion" then send "ENTER"would this be itControlSend("Confirm File Deletion", "{ENTER}")
exodius Posted December 18, 2006 Posted December 18, 2006 (edited) And look at WinWait and WinWaitActive to make sure that the window you wanna click on is actually up. And to answer your question, no, there's no way to do a program install that requires you to use Send or ControlSend commands without being logged into the computer as someone. If you're not logged in then AutoIt never sees the windows exist to interact with them. Edited December 18, 2006 by exodius
themush1326 Posted December 18, 2006 Author Posted December 18, 2006 ControlSend("Confirm File Deletion", "", "{ENTER}")And look at WinWait and WinWaitActive to make sure that the window you wanna click on is actually up.And to answer your question, no, there's no way to do a program install that requires you to use Send or ControlSend commands without being logged into the computer as someone. If you're not logged in then AutoIt never sees the windows exist to interact with them.Is there a way to mimic loggining in?The script i have works unless the person isnt logged in.It will even resume when the person logs in.
themush1326 Posted December 18, 2006 Author Posted December 18, 2006 Is there a need for both WinWaitActive and Control Send?
exodius Posted December 18, 2006 Posted December 18, 2006 Yes, two parts of the same equation. You do a ControlSend/ControlClick to go to the next screen, you do a WinWaitActive to validate that you're on that screen before doing another ControlSend/ControlClick. Otherwise depending on the speed of the machine/whatever else is using the processor you could send your ControlSend/ControlClicks too fast and they wouldn't reliably hit the right window. BTW, you might also want to check out ControlCommand in the helpfile...
herewasplato Posted December 18, 2006 Posted December 18, 2006 (edited) ...there's no way to do a program install that requires you to use Send or ControlSend commands without being logged into the computer as someone...I do not want to hijack this thread - but I thought that you could use ControlSend to work with applications while a user was not logged on - well, sort of not logged on... Using psexec.exe to push these two scripts to a system that had just restarted and had no one logged on. I did use a valid account on that system to push these two scripts. Script 1.exe:WinWait("Test This") ControlFocus("Test This", "", 2) ControlSend("Test This", "", 2, "{ENTER}")oÝ÷ Ù'+v{ºÚ"µÍÙÐÞ ][ÝÕÝÉ][ÝË ][ÝÉ][ÝÊBÛÝ[^JÚ[ÝÜÑ [È ][ÝÉÌLÛYYXIÌLÝYKØ]][ÝËJ I pushed 1.exe first and it just waited for the window from script 2. I used the -i and -c option of psexec. [Edit2: this is what I meant by - sort of logged on.] 1.exe returned with error code 0 from psexec 2.exe returned: An unexpected network error occurred. from psexec ...and yet the sound played so I can only assume that the "Test This" window was dealt with by ControlSend. Again, I do not want to hijack this thread - but can anyone shed some light on why psexec returned an error for 2.exe. Also, shouldn't you be able to handle the windows coming from an installation that you "pushed" via psexec using ControlFocus and ControlSend as long as you avoid the Win...Activ... functions and just use WinWait and good error checking on the Control functions??? Edit: yes, I tried it both ways... running 2.exe first works as well, but 2.exe completes once 1.exe is pushed and 2.exe still gives this error: An unexpected network error occurred Edited December 19, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
MHz Posted December 19, 2006 Posted December 19, 2006 And look at WinWait and WinWaitActive to make sure that the window you wanna click on is actually up.And to answer your question, no, there's no way to do a program install that requires you to use Send or ControlSend commands without being logged into the computer as someone. If you're not logged in then AutoIt never sees the windows exist to interact with them.It is possible. If you use functions that require active windows then you will fail. WinActive, WinWaitActive, WinActivate, Send and Mouse* functions are not suitable for locked or logged off environments.
probedrone Posted August 14, 2007 Posted August 14, 2007 I notice I am a bit late on the reply, but I have a similar problem as this one and as of yet found a solution... I go through a test procedure for a program with AUTOIT after remotely restarting that machine. Using psexec to push the autoit program through, the program would hang until someone logs in to the machine, then it will continue normally. Is there a way in autoit or a switch in psexec to bypass this? (I always wondered how the -i switch in psexec is used)
herewasplato Posted August 14, 2007 Posted August 14, 2007 I notice I am a bit late on the reply, but I have a similar problem as this one and as of yet found a solution...I go through a test procedure for a program with AUTOIT after remotely restarting that machine.Using psexec to push the autoit program through, the program would hang until someone logs in to the machine, then it will continue normally. Is there a way in autoit or a switch in psexec to bypass this?(I always wondered how the -i switch in psexec is used)You will need to post some code that replicates your problem. [size="1"][font="Arial"].[u].[/u][/font][/size]
probedrone Posted August 14, 2007 Posted August 14, 2007 Not that much code to post. I did use the Send commands however (controlsend does not work for me..?) and also winwaitactive. This should not work when the machine is logged off, so I need to either find a way to automate the logon process, or have the script run without logging on. The program I am working with does not have the toolbar buttons (File/Edit/View...) show up on the autoit window info. In fact this does not work on firefox either. Say i need to click File->Open Project, Autoit can only do so by doing: Send("!f") Send("^O") since I dont have the control ID to use for controlsend...
herewasplato Posted August 14, 2007 Posted August 14, 2007 ...Autoit can only do so by doing:Send("!f")Send("^O")since I dont have the control ID to use for controlsend...Does WinMenuSelectItem work with the workstation unlocked - if so, try it when it is locked - I cannot test it myself right now....... [size="1"][font="Arial"].[u].[/u][/font][/size]
probedrone Posted August 15, 2007 Posted August 15, 2007 Does WinMenuSelectItem work with the workstation unlocked - if so, try it when it is locked - I cannot test it myself right now.......WOW it works!Thanks... lots of great autoit functions being under-utilized!So my next problem is how do you use ControlSend?Are you supposed to see the text sent when you open the window? I me the function seems now to do anything....
herewasplato Posted August 15, 2007 Posted August 15, 2007 ...how do you use ControlSend?...See this post:http://www.autoitscript.com/forum/index.ph...st&p=160879 [size="1"][font="Arial"].[u].[/u][/font][/size]
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