wellknown Posted September 21, 2007 Share Posted September 21, 2007 I have tried to configure an AutoIt script to run as a Windows service to install application in the background automatically. But I found that AutoIt script cannot detect the presence of the application's GUI or the GUI cannot be output when starting from a service. May be it can work if the service is allowed to interact with the active desktop. But this is not what I want as there is no guarantee there is a logged on user. Also, it is no good to interfere with the current logged on user. Any suggestion or workaround? Thank you. Link to comment Share on other sites More sharing options...
Bert Posted September 21, 2007 Share Posted September 21, 2007 ummm, do you have any code you want to share? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
wellknown Posted September 21, 2007 Author Share Posted September 21, 2007 Dear Volly, Actually I am using xyNTservice to start a batch program as a service and use the batch program to run a simple AutoIt script to test whether it can interact with other GUI program for installation. The testing script is trying to invoke a notepad.exe, type some words on it and saving it as a file. The script is : Opt("WinTitleMatchMode", 2) Run("notepad.exe test.txt") WinWaitActive("Notepad") Send("This is some text.") sleep(3000) WinClose("Notepad") WinWaitActive("Notepad") Send("!y") It can work if the batch program is configured to interact with UserInterface in xyNTservice when a user is logged on. For other cases (no user is logged on or the batch program is configured not to interact with UserInterface in xyNTservice), it won't work and the testing script seems not able to detect the presence of the Notepad window and keeps waiting forever. Thank you. Link to comment Share on other sites More sharing options...
lordofthestrings Posted September 21, 2007 Share Posted September 21, 2007 when no user is logged in, no explorer.exe is loaded, meaning no userprofile, so nothing to interact with. this doesn't mean that you can't let a script run as system service, you just have to make it a silent script that doesn't do any gui interactions.. (you can access the filesystem, registry, ..) forget your simple notepad script. write a script using fileopen() and filewriteline() etc. to create a textfile, then schedule it using taskscheduler (standard in windows since ages). since this is allways launched using the NT Authority system account, everything it launches will launch as system service(logic I hope). this has one cool advantage.. write a script that waits for let's say 10 minutes using sleep() make sure you see the script running (active window not hidden) then schedule it using taskscheduler, when it is launched, log out, and log back in.. the script will still be running.. I hope this helps you a bit in user profile interaction Link to comment Share on other sites More sharing options...
wellknown Posted September 21, 2007 Author Share Posted September 21, 2007 Yes, it is just a testing script but I really want to be able to use this method to install application with GUI interaction by using AutoIt automatically without any logged on user. Is it possible or any workaround? Thank you. Link to comment Share on other sites More sharing options...
ptrex Posted September 21, 2007 Share Posted September 21, 2007 @all Have a look in my signature. There is an reference on how to run AU3 as a service. I tested it at the time and this GUI was interacting with the Desktop as far as I can remember. Regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New 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