AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need to restart the program after a while

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
MielVdB



Joined: 29 Mar 2008
Posts: 3

PostPosted: Sat Mar 29, 2008 4:42 pm    Post subject: Need to restart the program after a while Reply with quote

This is my issue;

I run Autohotkey, have a working script, run two programs, everything works fine. But after a while, I have to manually reload the script because it doesn't work anymore. After reloading, everything works fine again.
Does anyone have any idea what the problem could be?
Thanks in advance
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1125

PostPosted: Sat Mar 29, 2008 6:10 pm    Post subject: Reply with quote

Your script is obviously possessed by politicians who, though appearing to work at first, end up just doing nothing as soon as your attention is elsewhere.

btw, you forgot to put your script between [code][/code] tags in your post.
_________________
My Home Thread
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags
Back to top
View user's profile Send private message
epconfig



Joined: 10 Oct 2007
Posts: 19
Location: Montreal, Canada

PostPosted: Sat Apr 05, 2008 8:11 pm    Post subject: Reply with quote

One idea is that your script is indefinitely waiting for something. It can happen if you are not using correctly a command like ClipWait, WinWait, WinWaitActive, WinWaitClose and so on.
_________________
epconfig
Enterpad Keyboard for AutoHotkey
Back to top
View user's profile Send private message Visit poster's website
MielVdB



Joined: 29 Mar 2008
Posts: 3

PostPosted: Mon Apr 07, 2008 9:38 pm    Post subject: Reply with quote

[VxE] wrote:
Your script is obviously possessed by politicians who, though appearing to work at first, end up just doing nothing as soon as your attention is elsewhere.

btw, you forgot to put your script between [code][/code] tags in your post.

lol Smile

Anyway, here's my script:
Code:
killbroadcast = 0
WinGet, wowid, List, World of Warcraft

~Pause::
KeyWait, Pause, D
If(%killbroadcast% = 0)
{
    killbroadcast = 1
}
else
{
    killbroadcast = 0
    WinGet, wowid, List, World of Warcraft
}
Return

~1::
KeyWait 1, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, 1, ahk_id %target_window%
         }
      }
   }
}
Return

~2::
KeyWait 2, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, 2, ahk_id %target_window%
         }
      }
   }
}
Return

~3::
KeyWait 3, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, 3, ahk_id %target_window%
         }
      }
   }
}
Return

~4::
KeyWait 4, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, 4, ahk_id %target_window%
         }
      }
   }
}
Return

~5::
KeyWait 5, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, 5, ahk_id %target_window%
         }
      }
   }
}
Return

~6::
KeyWait 6, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, 6, ahk_id %target_window%
         }
      }
   }
}
Return

~7::
KeyWait 7, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, 7, ahk_id %target_window%
         }
      }
   }
}
Return

~8::
KeyWait 8, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, 8, ahk_id %target_window%
         }
      }
   }
}
Return

~9::
KeyWait 9, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, 9, ahk_id %target_window%
         }
      }
   }
}
Return

~0::
KeyWait 0, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, 0, ahk_id %target_window%
         }
      }
   }
}
Return

~-::
KeyWait -, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, -, ahk_id %target_window%
         }
      }
   }
}
Return

~=::
KeyWait =, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, =, ahk_id %target_window%
         }
      }
   }
}
Return

~F1::
KeyWait F1, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F1}, ahk_id %target_window%
         }
      }
   }
}
Return

~F2::
KeyWait F2, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F2}, ahk_id %target_window%
         }
      }
   }
}
Return

~F3::
KeyWait F3, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F3}, ahk_id %target_window%
         }
      }
   }
}
Return

~F4::
KeyWait F4, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F4}, ahk_id %target_window%
         }
      }
   }
}
Return

~F5::
KeyWait F5, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F5}, ahk_id %target_window%
         }
      }
   }
}
Return

~F6::
KeyWait F6, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F6}, ahk_id %target_window%
         }
      }
   }
}
Return

~F7::
KeyWait F7, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F7}, ahk_id %target_window%
         }
      }
   }
}
Return

~F8::
KeyWait F8, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F8}, ahk_id %target_window%
         }
      }
   }
}
Return

~F9::
KeyWait F9, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F9}, ahk_id %target_window%
         }
      }
   }
}
Return

~F10::
KeyWait F10, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F10}, ahk_id %target_window%
         }
      }
   }
}
Return

~F11::
KeyWait F11, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F11}, ahk_id %target_window%
         }
      }
   }
}
Return

~F12::
KeyWait F12, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {F12}, ahk_id %target_window%
         }
      }
   }
}
Return

~/::
KeyWait /, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      killbroadcast=1
   }
}
Return

~Enter::
KeyWait Enter, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% <> 0)
   {
      killbroadcast = 0
   }
   else
   {
      killbroadcast = 1
   }
}
Return

~NumpadEnter::
KeyWait NumpadEnter, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% <> 0)
   {
      killbroadcast = 0
   }
   else
   {
      killbroadcast = 1
   }
}
Return

~Backspace::
KeyWait Backspace, D
WinGet, Active_Window, ID, A
IfWinActive, World of Warcraft
{
   If(%killbroadcast% = 0)
   {
      Loop, %wowid%
      {
         target_window := wowid%A_index%
         If (Active_Window <> target_window)
         {
            ControlSend,, {Backspace}, ahk_id %target_window%
         }
      }
   }
}
Return
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1125

PostPosted: Mon Apr 07, 2008 11:12 pm    Post subject: Reply with quote

Try replacing every instance of
Code:
{
   If(%killbroadcast% <> 0) ; this is your error line
   {
      killbroadcast = 0
   }
   else
   {
      killbroadcast = 1
   }
}

with
Code:
killbroadcast := !killbroadcast

then, replace every remaining instance of
Code:
If (%killbroadcast% <> 0)

with
Code:
If killbroadcast

then, replace every remaining instance of
Code:
If (%killbroadcast% = 0)

with
Code:
If !killbroadcast

_________________
My Home Thread
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags
Back to top
View user's profile Send private message
MielVdB



Joined: 29 Mar 2008
Posts: 3

PostPosted: Fri Apr 11, 2008 7:45 pm    Post subject: Reply with quote

Thanks alot mate, gonna try it right away!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group