AutoHotkey Community

It is currently May 26th, 2012, 9:46 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: May 15th, 2009, 1:59 am 
Offline

Joined: May 15th, 2009, 1:54 am
Posts: 1
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 15th, 2009, 2:30 pm 
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.


Report this post
Top
  
Reply with quote  
PostPosted: May 15th, 2009, 3:01 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 15th, 2009, 6:02 pm 
Offline

Joined: July 25th, 2006, 7:37 pm
Posts: 490
Location: Midwest, USA
Add a WinWait before the IfWinNotActive. It might be trying to figure out if it is active, before the program is even loaded.

_________________
SilverEdge78


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 15th, 2009, 6:23 pm 
are you logged off, when the task-scheduler starts your script?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2009, 2:18 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2009, 3:56 pm 
Offline

Joined: July 25th, 2006, 7:37 pm
Posts: 490
Location: Midwest, USA
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 7:20 pm 
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/topic46 ... ght=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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 9:02 pm 
Offline

Joined: July 25th, 2006, 7:37 pm
Posts: 490
Location: Midwest, USA
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 11:00 pm 
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?


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, JSLover, patgenn123, rbrtryn, virpara and 56 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group