AutoHotkey Community

It is currently May 24th, 2012, 7:55 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Problem with Pause
PostPosted: March 7th, 2007, 9:09 pm 
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
}



Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2007, 9:46 pm 
Offline

Joined: February 13th, 2006, 10:40 pm
Posts: 389
Location: Utah
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.

_________________
Image
"Power can be given overnight, but responsibility must be taught. Long years go into its making."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2007, 10:09 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 7th, 2007, 10:55 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2007, 3:36 am 
Thanks very much for the help, it works :)


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: billym, Exabot [Bot], Google [Bot], Pulover and 78 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