Milordzie Posted February 8, 2013 Share Posted February 8, 2013 Hi i writed simple script and i can't find how to start script stoped MsgBox ( 4096, "xxx" ) SoundPlay(@WindowsDir & "\media\Windows Ding.wav", 0) Global $Paused HotKeySet("{PAUSE}", "TogglePause") While 1=1 ControlSend("xxx", "", "", "{1 DOWN}") Sleep(3000) WEnd Func TogglePause() SoundPlay(@WindowsDir & "\media\Heritage\Windows Error.wav", 0) $Paused = Not $Paused While $Paused Sleep(0) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2013 Moderators Share Posted February 8, 2013 Milordzie,Welcome to the AutoIt forum. Just call the TogglePause function as the script starts: Global $Paused = False ; Set the flag to False so it becomes True as you enter the function for the first time HotKeySet("{PAUSE}", "TogglePause") MsgBox(4096, "xxx", "xxx") SoundPlay(@WindowsDir & "\media\Windows Ding.wav", 0) ; Call the function to pause the script initially TogglePause() While 1 ;ControlSend("xxx", "", "", "{1 DOWN}") MsgBox(0, "hi", "Sending") Sleep(3000) WEnd Func TogglePause() SoundPlay(@WindowsDir & "\media\Windows Error.wav", 0) $Paused = Not $Paused While $Paused Sleep(10) ; 10 is the minimum sleep value ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePauseAnd please forgive me for being suspicious, but whenever I see "xxx" titles I always suggest the the OP reads the Forum rules (there is also a link at bottom right of each page) before they post again. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Milordzie Posted February 8, 2013 Author Share Posted February 8, 2013 thx but when i try to run your code i got errors $Paused = Not $Paused$Paused = Not ^ ERRORand i use sleep 0 for pause script to next click of pause on keyboard. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 8, 2013 Developers Share Posted February 8, 2013 It helps to also tell what the error is. Show what you have now.... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2013 Moderators Share Posted February 8, 2013 Milordzie,Are you sure you have the Global $Paused = False at the top of the script? And as I said in the script, do not use Sleep(0). The minimum Sleep possible is around about 10ms - this is a system limitation, not an AutoIt one - and Sleep(0) is a special case which just gives up the next possible timeslice. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Milordzie Posted February 8, 2013 Author Share Posted February 8, 2013 (edited) Hmm i feel like in "back to the future" scrpit is starting without errors but not paused - just start spam key "1" when i click pause on keyboard i can turn on/off it. But how i can start script stoped SoundPlay(@WindowsDir & "\media\Windows Ding.wav", 0) Global $Paused = False HotKeySet("{PAUSE}", "TogglePause") While 1=1 ControlSend("clientI", "", "", "{1 DOWN}") Sleep(3000) WEnd Func TogglePause() SoundPlay(@WindowsDir & "\media\Heritage\Windows Error.wav", 0) $Paused = Not $Paused While $Paused Sleep(100000000) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Edited February 8, 2013 by Milordzie Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2013 Moderators Share Posted February 8, 2013 Milordzie,Did you actually look at the script I posted above - it shows you exactiy how to do it. You are missing a vital line in the script you have just posted. ; Call the function to pause the script initially TogglePause()M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Milordzie Posted February 8, 2013 Author Share Posted February 8, 2013 Thx man a lot. its work. Sorry for my stiupid questions but i have few more about Koda FormDesinger. I maked simple window to: chose key for: controlsend ControlSend("clientI", "", "", "{1 DOWN}") i want put here something like $label2 and for set time of sleep in whileSleep(3000)and i hope last question when i run GUI my inputs are hidden i must move muse on window to see them #include #include #include #include #include #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Form1", 637, 334, 192, 124) $Czas = GUICtrlCreateInput("Czas", 464, 104, 121, 21) $Combo1 = GUICtrlCreateCombo("Klawisz", 464, 48, 169, 25) GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|F1|F2|F3|F4|F5|F6|F7|F8|F9") $Label1 = GUICtrlCreateLabel("Klawisz", 464, 24, 39, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $Label2 = GUICtrlCreateLabel("Czas w mili sekundach", 464, 80, 111, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) $Pic1 = GUICtrlCreatePic("C:\Users\Exmple\Downloads\08a.jpg", -8, -8, 644, 340) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2013 Moderators Share Posted February 8, 2013 Milordzie,I know nothing about Koda as I do not use it, sorry.As to the "hiding" inputs - you need to disable the pic control (GUICtrlSetState($Pic1, $GUI_DISABLE)) when you use it as a background. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ileandros Posted February 9, 2013 Share Posted February 9, 2013 (edited) Something like this? I don't really understand your english $label2 = "{1 DOWN}" ControlSend("clientI","","",$label2) ;Sleep $label3 = 3000 Sleep($label3) Edited February 9, 2013 by ileandros I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now