 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Lem0nHead
Joined: 15 May 2009 Posts: 1
|
Posted: Fri May 15, 2009 12:59 am Post subject: it doesn't focus on the windows with task scheduler |
|
|
hello
I have a script for doing my backups of applications that doesn't offer a simpler way
firefox is one of those... although there's MozBackup has an option to use a config script which automatically should do the backup, it didn't work for me
so I wrote an autohotkey script and it works fine on my tests
however, when it runs from task scheduler, it just doesn't focus on mozbackup window:
| Code: | Run, c:\Arquivos de programas\mozbackup\MozBackup.exe
Sleep 5000
IfWinNotActive, MozBackup , , WinActivate, MozBackup ,
WinWaitActive, MozBackup ,
Sleep 5000
... stuff to do here
|
when I come back the next day, the MozBackup window is out of focus and, if I just click it, autohotkey keeps going
so, any ideas on what may be happening?
thanks |
|
| Back to top |
|
 |
Jimley Guest
|
Posted: Fri May 15, 2009 1:30 pm Post subject: |
|
|
No idea on your question. You should write another area with a loop to make sure the window is always active
Loop,
IfWinNotActive,
WinActivate,
Etc. It's not a fix for your question, but it should band-aid the situation hopefully. |
|
| Back to top |
|
 |
Guest
|
Posted: Fri May 15, 2009 2:01 pm Post subject: Re: it doesn't focus on the windows with task scheduler |
|
|
| Lem0nHead wrote: | | so, any ideas on what may be happening? |
No, but if you make use of ERRORLEVEL you can find what is going wrong.
| Code: | Run, c:\Arquivos de programas\mozbackup\MozBackup.exe,,,,ID
WinWait ahk_pid %ID%,,5 ; (sets LastFound window) wait up to 5 seconds for window to appear
if ErrorLevel
MsgBox, Timed out waiting for MozBackup window
IfWinNotActive ; use LastFound window
WinActivate ; use LastFound window
WinWaitActive,,,5 ; use LastFound window - wait up to 5 seconds for window to become active
if ErrorLevel
MsgBox, Timed out waiting for MozBackup window to become active
... stuff to do here |
|
|
| Back to top |
|
 |
silveredge78
Joined: 25 Jul 2006 Posts: 481 Location: Midwest, USA
|
Posted: Fri May 15, 2009 5:02 pm Post subject: |
|
|
Add a WinWait before the IfWinNotActive. It might be trying to figure out if it is active, before the program is even loaded. _________________ SilverEdge78 |
|
| Back to top |
|
 |
Z_Gecko Guest
|
Posted: Fri May 15, 2009 5:23 pm Post subject: |
|
|
| are you logged off, when the task-scheduler starts your script? |
|
| Back to top |
|
 |
Guest
|
Posted: Mon May 18, 2009 1:18 am Post subject: |
|
|
that didn't run yet because it's just once a week, but I just though about something
may the welcome screen (I configured windows to lock after a few minutes of inactivity) be changing the autohotkey work (specially when it's run from task scheduler and has to click on things)?
thanks |
|
| Back to top |
|
 |
silveredge78
Joined: 25 Jul 2006 Posts: 481 Location: Midwest, USA
|
Posted: Mon May 18, 2009 2:56 pm Post subject: |
|
|
Okay, if you're script includes things like manipulating a window or sending keystrokes, it will not work when your computer is locked/logged off. You might want to look into ControlSend if you need to do that. _________________ SilverEdge78 |
|
| Back to top |
|
 |
sixfoot Guest
|
Posted: Tue Sep 22, 2009 6:20 pm Post subject: |
|
|
| silveredge78 wrote: | | Okay, if you're script includes things like manipulating a window or sending keystrokes, it will not work when your computer is locked/logged off. You might want to look into ControlSend if you need to do that. |
I have this same problem and have discovered it is because my computer is locked. Here is my thread I started:
http://www.autohotkey.com/forum/topic49128.html
I've also read this thread:
http://www.autohotkey.com/forum/topic46374.html&highlight=locked
My script only involves mouse movements and clicking. Is there a way I can do this while the computer is locked?
Thanks in advance. |
|
| Back to top |
|
 |
silveredge78
Joined: 25 Jul 2006 Posts: 481 Location: Midwest, USA
|
Posted: Tue Sep 22, 2009 8:02 pm Post subject: |
|
|
As previously noted, look into ControlSend and the similar commands in the manual. Moving the mouse and clicking doesn't do anything when the workstation is locked. I've found that I can do things behind the scenes using other commands or ControlSend. If you can't get the clicks to work right behind the scenes, look into keystrokes. Most GUIs will allow you to tab around to the appropriate control, or use Alt + special keys to activate them. I find these much more accurate than clicks personally.
Good luck. _________________ SilverEdge78 |
|
| Back to top |
|
 |
sixfoot Guest
|
Posted: Tue Sep 22, 2009 10:00 pm Post subject: |
|
|
| silveredge78 wrote: | As previously noted, look into ControlSend and the similar commands in the manual. Moving the mouse and clicking doesn't do anything when the workstation is locked. I've found that I can do things behind the scenes using other commands or ControlSend. If you can't get the clicks to work right behind the scenes, look into keystrokes. Most GUIs will allow you to tab around to the appropriate control, or use Alt + special keys to activate them. I find these much more accurate than clicks personally.
Good luck. |
Darn. I tried what you said with the ControlSend, and it just won't do anythign when the computer is locked. I tried all keystrokes too. I'm on 64-bit Vista. Any other ideas? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|