nugame Posted July 12, 2006 Share Posted July 12, 2006 I developed a nice automation with autoit to run applications to export csv files on multiple computers. These scripts are started from the windows task scheduler. I also developed a GUI application to download these files to a server for data analysis and reports. It works great. So far, I see a problem with the screen saver preventing the scheduled scripts to complete after it starts. The screen saver requires login by user. How would I get pass the screen saver? Thanks. Dr SherlockAlways a way Link to comment Share on other sites More sharing options...
Bert Posted July 12, 2006 Share Posted July 12, 2006 You need to have the script running as a service. Also, you may need to have it so you do not use any type of keyboard or mouse action to conduct what you need, for the screensaver would prevent what you want to do. Did you look into useing ExcelCOM by Randell? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
nugame Posted July 12, 2006 Author Share Posted July 12, 2006 Thanks for that Excelcom info. That would be something I believe I would need to massage the csv files assuming I can use it for MS Office xp Pro (2002). I saw other post when ExcelCOM only works with 2003 version. Can you verify. I need to add more info I guess. Sorry. To get the csv files, I have to use keyboard and mouse actions since the two programs are not standard programs like Office. It is a POS software. Screen saver is the only current blocker. So, I would have a service to log into the screen to get the desktop. Would that be the solution? Thanks again. Dr SherlockAlways a way Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 12, 2006 Share Posted July 12, 2006 I don't think AutoIt scripts can be services. They require a lot of non-standard code to work. Link to comment Share on other sites More sharing options...
Briegel Posted July 12, 2006 Share Posted July 12, 2006 I don't think AutoIt scripts can be services. They require a lot of non-standard code to work.Yes they can!Have a look here at the solution from th.meger.Hope I can help.Briegel Link to comment Share on other sites More sharing options...
nugame Posted July 13, 2006 Author Share Posted July 13, 2006 Hmmm. I will try this for the data management script. Still need to do scripts with mouse and kb actions when windows screen saver is running requiring user to login. Thanks Dr SherlockAlways a way Link to comment Share on other sites More sharing options...
nugame Posted July 14, 2006 Author Share Posted July 14, 2006 OK. No matter what I cannot use services while I still have some mouse and keyboard controls. The application I am working with have report dialogs that has listboxes, comboboxes, checkboxes, and buttons. The listboxes and comboboxes are controlled by mouseclicks which works fine. But which screen saver, if fails as expected. I used the following commands to simply select item in listbox: If Not WinActive("Sales Report","") Then WinActivate("Sales Report","") $hlistbox = ControlGetHandle("Sales Report","","ListBox1") ControlCommand("Sales Report","",$hlistbox,"SetCurrentSelection",4) This did not work. AutoIt Window Info shows the listbox as ListBox1, so I should be able to do the item selection. What is wrong here? Dr SherlockAlways a way Link to comment Share on other sites More sharing options...
Zedna Posted July 14, 2006 Share Posted July 14, 2006 Hmmm. I will try this for the data management script. Still need to do scripts with mouse and kb actions when windows screen saver is running requiring user to login. ThanksMaybe in your background script try instantly simulate mouse movement (0 pix and only when computer is idle) to prevent screensaver to run... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Bert Posted July 14, 2006 Share Posted July 14, 2006 One thing you can do while the script runs is mut in a small mouse move to keep the screensaver from starting. I'm not sure your company rules would allow this, but I do know it would work. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
nugame Posted July 15, 2006 Author Share Posted July 15, 2006 Solve the problem below: If Not WinActive("Sales Report","") Then WinActivate("Sales Report","") $hlistbox = ControlGetHandle("Sales Report","","ListBox1") ControlCommand("Sales Report","",$hlistbox,"SetCurrentSelection",4) Needs to be from the Beta side: If Not WinActive("Sales Report","") Then WinActivate("Sales Report","") $hlistbox = ControlGetHandle("Sales Report","","ListBox1") $ret = _GUICtrlListSetSel($hlistbox, 1, 1) Now a couple question: I am almost done replacing the mouse/KB actions to ControlCommand by first getting the handle on each GUI control object. I still have a couple of ControlClick left. Is ControlClick consider mouse action? No matter I am replacing everything for no mouse/KB actions. Still, what is 'mut' in the last reply. Final question - now I need to work on making a script run as a service. I saw and reviewed the not tested script. Make sense. Script from Mega below Func _SrvAny($service, $fullpath, $hidden = 0) ; Adds a program, as a windows service. ; Requires $instsrv and $srvany to be assigned, full paths. ; e.g. _SrvAny ( 'ServiceName', 'FullPath_to_the_program' ) Local $instsrv = @WindowsDir & '\System32\Instsrv.exe' Local $srvany = @WindowsDir & '\System32\SrvAny.exe' If FileExists($instsrv) And FileExists($srvany) Then RunWait($instsrv & ' ' & $service & ' "' & $srvany & '"', '', @SW_HIDE) Local $key = 'HKLM\SYSTEM\CurrentControlSet\Services\' & $service If RegRead($key, 'DisplayName') Then If $hidden Then RegWrite($key & '\Parameters', 'AppParameters', 'Reg_sz', '/hidden') Return RegWrite($key & '\Parameters', 'Application', 'Reg_sz', $fullpath) EndIf EndIf EndFunc Do I run this function with each script then cleanup by removing the service or should I leave it there for the next day? Almost there and thanks for the help. Dr SherlockAlways a way Link to comment Share on other sites More sharing options...
MHz Posted July 15, 2006 Share Posted July 15, 2006 Using any of the Control*() functions should be fine. With _SrvAny(), that will setup a permanent service. If you want to stop, delete etc. the service, then consider using SC.exe to do that, which would be in (WinXP or above, not sure of W2k) system directory. Just use SC /? at a command prompt for switches available. Link to comment Share on other sites More sharing options...
nugame Posted July 17, 2006 Author Share Posted July 17, 2006 OK. The SC.exe has a create command. If one can delete the service with sc.exe then can't one use the sc.exe support. The sc.exe is supported in XP and W2k (it is in the W2k resource kit which I downloaded). So, _SrvAny() is supported for XP and W2k? I have three systems on the network to automate - 1 is a Win XP Pro and the other two are Win 2000 Pro. I did play and automate with SC.exe in creating and delete in XP. Creation was fine but could not start the service. I am sure I did something wrong. Thanks. Dr SherlockAlways a way Link to comment Share on other sites More sharing options...
Briegel Posted July 17, 2006 Share Posted July 17, 2006 What about... sc <server> start [service name] ...? Link to comment Share on other sites More sharing options...
nugame Posted July 17, 2006 Author Share Posted July 17, 2006 That is what I did without the server since I am on local machine. Is there a limitation on programs? Dr SherlockAlways a way Link to comment Share on other sites More sharing options...
Briegel Posted July 17, 2006 Share Posted July 17, 2006 I don't know anything about limitation. Did you try this? net start 'servicename shown in services.msc' Link to comment Share on other sites More sharing options...
nugame Posted July 18, 2006 Author Share Posted July 18, 2006 Yes. I did the net start and sc start and both gave the errorsC:\Documents and Settings\ws4sadc>sc start test[sC] StartService FAILED 1053:The service did not respond to the start or control request in a timely fashion.C:\Documents and Settings\ws4sadc>net start testThe service is not responding to the control function.More help is available by typing NET HELPMSG 2186.The error occurs after about 30 seconds. My research so far is telling that there is a bug in the NET Framework. I need to get the NET Framework 1.1 version patch. Check this link out and tell me what you think -- http://support.microsoft.com/kb/839174/. Getting the updates now and will check back. Dr SherlockAlways a way Link to comment Share on other sites More sharing options...
nugame Posted July 26, 2006 Author Share Posted July 26, 2006 Check this out - http://www.splinterware.com/products/wincron.htm. This pro version answered all of the requirements and it works great. Now, three and soon to be four works with all of the autoit scripts I developed. What do you think? Dr SherlockAlways a way 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