Show Timer, Continue After 10 seconds
Posted: 13 Apr 2018, 01:34
How can I pause the script while my countdown timer displays? Sounds easy. I thought so too! This Script pulls out even or odd lines from the clipboard. I want the user to know his clipboard has been restored after about 10 seconds. This gives him time to paste the odd lines, before the original clipboard is restored. I have a timer that displays a countdown, but nothing I've tried can stop the script during those 10 seconds and continue, without breaking the timer display in some way.
Ideas? Thank you!
By the way, if using SciTE hit your right alt key to save and refresh this script for quick testing!
Ideas? Thank you!
By the way, if using SciTE hit your right alt key to save and refresh this script for quick testing!
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance, Force
#InstallKeybdHook
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 2
return
F3::
; This extracts even or odd lines from clipboard
EvenOrOddLines=
ClipboardStorage := CouldBeClipboard
;myvar := Clipboard
myvar =
(
1
2
3
4
5
6
7
)
Gui 3:default
Gui Add, Picture, x10 y20 w300 h300, %A_ScriptDir%\images\logo.jpg
Gui, Add, Text, yp+40, Extract Even and Odd LInes
Gui, Add, Edit, yp+40 vSomeVariableOne, This is an Unused Edit Box
Gui, Add, Text, yp+40, This is the Second Text Line
Gui, Add, Edit, yp+40 vSomeVariableTwo, Second Unused Edit Box
Gui, Add, Text, yp+40, Third Line of Text
Gui, Add, Edit, yp+40 vSomeVariableThree, Third Unused Edit Box
Gui, Add, Text, yp+40, Fourth Line of Text
Gui Add, Edit, yp+40 vSomeVariableFour, Another EditBox String
Gui, Add, Button, Default gOK1, Extract Odd Lines
Gui, Add, Button, Default gOK2, Extract Even Lines
Gui, Add, Button, Default gOK3, Unused Button
Gui Show, , Window
Return
OK1: ; Odd Lines
Gui, Submit
sleep 400
Loop, parse, myvar, `n
EvenOrOddLines .= Mod( A_Index,2 ) ? A_LoopField "`n" : ""
MsgBox, You Have 7 seconds after clicking OK to paste these lines somewhere `n Before Clipboard is restored `n `n %EvenOrOddLines%
Gui, Destroy
Clipboard := EvenOrOddLines
;sleep 8000
SetTimer, Timed, 10
Clipboard := ClipboardStorage
MsgBox Your Clipboard has been restored to this: `n %ClipboardStorage%
return
Timed:
++curTime
timed := round(CurTime/3, 1)
if timed < 10
{
ToolTip, %timed%
sleep 300
tooltip
}
;sleep 7000 breaks everything
return
OK2: ; Even Lines
Gui, Submit
sleep 400
Loop, parse, myvar, `n
EvenOrOddLines .= Mod( A_Index,2 ) ? "" : A_LoopField "`n"
MsgBox, You Have 7 seconds after clicking OK to paste these lines somewhere `n Before Clipboard is restored `n `n %EvenOrOddLines%
Gui, Destroy
Clipboard := EvenOrOddLines
sleep 7000
Clipboard := ClipboardStorage
return
OK3: ; Unused
Gui, Submit
sleep 400
MsgBox something
Gui, Destroy
return
3GuiEscape:
3GuiClose:
;MsgBox % vText1 "'n" vText2 vText3 vRadioState
MsgBox Okay - Doing Nothing
Gui, Destroy
return
;======================= STANDARD AUTOHOTKEY FOOTER
RAlt::
IfWinActive, SciTE
{
sendinput ^s
sleep 300
}
IfWinExist, DebugView
{
;MsgBox hello
ControlSend, , ^x, DebugView
sleep 300
}
Reload
return
^Esc::
exitapp
return
BIGEXIT:
exit