iot Posted August 25, 2006 Share Posted August 25, 2006 (edited) Hi there, I've been using AutoIt for automating some processes and it worked perfect, but I have a problem and don't know if AutoIt could solve it. I need that an AutoIt script runs although no windows session has started or if it's blocked the session. Of course, I know passwords of the user who would run the script. I tried to run the compiled script through the task manager but didn't work. Something like this, don't work: Run("notepad.exe c:\sample\sample.txt") WinWait("sample.txt - Notepad") WinActivate("sample.txt - Notepad") Send("This is some text.{ENTER}") WinClose("sample.txt - Notepad") WinWait("Notepad", "The text in the Untitled file has changed") WinActivate("Notepad", "The text in the Untitled file has changed") Send("!s") I thought it could be an issue that the windows didn't show on screen, so I tried, again without success the next code: Run("notepad.exe c:\sample\sample.txt") Sleep(1000) Send("This is some text.{ENTER}") Sleep(1000) Send("!{F4}") Sleep(1000) Send("!s") Can I do with AutoIt what I need? If not, do you know any other app who could do it? All help will be welcome Thanks in advance! Edited August 25, 2006 by iot Link to comment Share on other sites More sharing options...
lod3n Posted August 25, 2006 Share Posted August 25, 2006 Well part of the problem is that when there's no active session, or the screen is locked, no window can be "active". Which firstly means that you have to change from WinWaitActive to WinWait. Secondly I am dubious about the send commands, as you can't be sure you're sending to Notepad. I'd use ControlSend instead, so that you can name the window and control you're trying to automate. if you can get the program working with WinWait and ControlSend, and further, make it work when you lock your workstation, it will probabaly work as a scheduled task too. You really ought to think about not relying on GUI based methods to accomplish your objectives though. Good luck. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
iot Posted August 28, 2006 Author Share Posted August 28, 2006 Well part of the problem is that when there's no active session, or the screen is locked, no window can be "active". Which firstly means that you have to change from WinWaitActive to WinWait. Secondly I am dubious about the send commands, as you can't be sure you're sending to Notepad. I'd use ControlSend instead, so that you can name the window and control you're trying to automate.if you can get the program working with WinWait and ControlSend, and further, make it work when you lock your workstation, it will probabaly work as a scheduled task too.You really ought to think about not relying on GUI based methods to accomplish your objectives though. Good luck.Thanks, ControlSend worked great! 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