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 

Problem with Pause

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





PostPosted: Wed Mar 07, 2007 9:09 pm    Post subject: Problem with Pause Reply with quote

i am trying to make my script able to be paused right after running then resume when i unpause it. I tried to use the Pause::Pause to bind the pause key to pause which works but it wont run the rest of my script even if i do not pause it. If i remove that line then the rest of the script runs normally how it is suppose to. I even tried adding a Pause, Off bleow it, then above it and neither work. I double click the taskbar icon to see what was run in the script and it keeps stopping as soon as it hits the Pause::Pause. Any help on fixing this would be greatly appreciated.

Code:
 
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.

#InstallKeybdHook ; Install Keyboard Hook
#UseHook ON ; Turn Hook On
#Persistent
#SingleInstance FORCE

Process, Priority,, Realtime ; Set Script priority to Realtime

Pause, Off
Pause::Pause

Sleep, 3000
SendRaw U
Sleep, 100
Loop 5
{
 Loop 10
  {
   SendRaw 1
   Sleep, 3000
   SendRaw 2
   Sleep, 1500
   SendRaw 3
   Sleep, 1000
  }
 SendRaw P
 Sleep, 100
 SendRaw P
 Sleep, 100
 SendRaw P
 Sleep, 10000
 SendRaw 3
 Sleep, 1000
}

Back to top
Veovis



Joined: 13 Feb 2006
Posts: 390
Location: Utah

PostPosted: Wed Mar 07, 2007 9:46 pm    Post subject: Reply with quote

AHK manual wrote:
After the script has been loaded, it begins executing at the top line, continuing until a Return, Exit, hotkey/hotstring label, or the physical end of the script is encountered (whichever comes first). This top portion of the script is referred to as the auto-execute section.

_________________

"Power can be given overnight, but responsibility must be taught. Long years go into its making."
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Physical
Guest





PostPosted: Wed Mar 07, 2007 10:09 pm    Post subject: Reply with quote

well i am not sure how that applies to my problem but ty anyway. After reading it i tried another thing. No matter where in my script i put the Pause::Pause, as soon as it reaches that point the script stops. If anyone can please help me get this pause thing working properly i would greatly appreciate it. The help file doesnt go into anymore detail about what else i should do. Otherwise i am just going to have to remove it completely and put a longer sleep so i can manually pause the script by clicking the tray icon. Ty for any help.
Back to top
Zippo()
Guest





PostPosted: Wed Mar 07, 2007 10:55 pm    Post subject: Reply with quote

What Veovis posted means you needed to put the pause hotkey outside of the auto-execute section:
Code:
 
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.

#InstallKeybdHook ; Install Keyboard Hook
#UseHook ON ; Turn Hook On
#Persistent
#SingleInstance FORCE


Process, Priority,, Realtime ; Set Script priority to Realtime

Pause, On ;This will stop the script

Sleep, 3000
SendRaw U
Sleep, 100
Loop 5
{
 Loop 10
  {
   SendRaw 1
   Sleep, 3000
   SendRaw 2
   Sleep, 1500
   SendRaw 3
   Sleep, 1000
  }
 SendRaw P
 Sleep, 100
 SendRaw P
 Sleep, 100
 SendRaw P
 Sleep, 10000
 SendRaw 3
 Sleep, 1000
}
Return ;1st return, ends auto-execute section

Pause::Pause, Toggle ;Toggle pause state
Back to top
Physical
Guest





PostPosted: Thu Mar 08, 2007 3:36 am    Post subject: Reply with quote

Thanks very much for the help, it works Smile
Back to top
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