BenjaminAlvarado Posted November 15, 2012 Share Posted November 15, 2012 Hello again! I have found myself in a predicament. probably a rookie mistake how do I cancel/stop a script that I started to run before it has run its course? Example, I was playing with Run functions and writing texts in notepad. I made it run for 3.4 hours dont ask me why. . . . got happy with scripting! Now I dont knwo how to stop it? I saved my scripts and deleted the file, but it still keeps going. . . . . its haunted I Tell ya. . . so how do I turn on a script that would run for a long time but interrupt it and stop it at will? In anticipation of this I Removed the blockedInput from the start and end of the script, but that doesn't do anything. . . . thanks for your time! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 15, 2012 Moderators Share Posted November 15, 2012 BenjaminAlvarado,Please post the script you used - without it we are only whistling in the dark. Although I think a HotKey sounds like what you need. And when you post your code please use Code tags - put [autoit] before and [/autoit] after your posted code - then you get a nice scrolling box to hold it. 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...
DicatoroftheUSA Posted November 15, 2012 Share Posted November 15, 2012 Right click on the tray icon? Statism is violence, Taxation is theft. Autoit Wiki Link to comment Share on other sites More sharing options...
BenjaminAlvarado Posted November 15, 2012 Author Share Posted November 15, 2012 ok sorry, didn't think the code was needed (duh me ) BlockInput(1) Run("notepad.exe C:UsersBenjyDesktopfff.txt") WinWaitActive("fff - Notepad") AutoItSetOption("SendKeyDelay", 100) Send("ummm so this is supposed to be on a different line {enter} not sure what that means though." & @CRLF & "This should be on a new line!") WinClose("fff - Notepad") WinWaitActive("Notepad") Send("!s") $sData = MsgBox(0, "To Commander Atg", "Everything has been done as ordered Sir!", 4) AutoItSetOption("SetKeyDelay", 60000) Send("oooooooooo") Run("notepad.exe C:UsersBenjyDesktopfff.txt") WinWaitActive("fff - Notepad") AutoItSetOption("SendKeyDelay", 120) Send("ummm so this is supposed to be on a different line {enter} not sure what that means though." & @CRLF & "This should be on a new line!") WinClose("fff - Notepad") WinWaitActive("Notepad") Send("!s") MsgBox(0, "To Commander Atg", "Everything has been done as ordered Sir!", 4) BlockInput(0) THis is the snippet of it. dont laugh! yes I used the "o" per 1 minute to ad up to however long I put it at. and I just copied and pasted x10 since I dont know how to loop yet. Also I used the varialbe that I think I set "$sData" and it didn't put the msg box back up at the end. I had to put the line of script. Link to comment Share on other sites More sharing options...
Mechaflash Posted November 15, 2012 Share Posted November 15, 2012 THis is the snippet of it. dont laugh! yes I used the "o" per 1 minute to ad up to however long I put it at. and I just copied and pasted x10 since I dont know how to loop yet. For $i = 1 To 10 [code to run X10] Next Ctrl+Alt+Del and kill the script? If you've forced it to run another .exe, you'll have to kill IT as well. Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Mechaflash Posted November 15, 2012 Share Posted November 15, 2012 Key rule to programming: Always have a way to exit safely =D Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
BenjaminAlvarado Posted November 16, 2012 Author Share Posted November 16, 2012 (edited) thanks on the info! I loop now still my improvisation was rather rookie-genius no? @m23 I found the hotkey command. . . . . i think "HotKeySet( "key" [, "function"] )" and I put it into my code like such "hotkeyset("p', "terminate")" but it doesn't shut it down? here is the code. I also tried "exit" but "terminate" was the example given in the help article. BlockInput(1) HotKeySet("p", "Terminate") Run("notepad.exe C:UsersBenjyDesktopfff.txt") WinWaitActive("fff - Notepad") AutoItSetOption("SendKeyDelay", 100) Send("ummm so this is supposed to be on a different line {enter} not sure what that means though." & @CRLF & "This should be on a new line!") WinClose("fff - Notepad") WinWaitActive("Notepad") Send("!s") $sData = MsgBox(0, "To Commander Atg", "Everything has been done as ordered Sir!", 4) AutoItSetOption("SetKeyDelay", 60000) Send("oooooooooo") Run("notepad.exe C:UsersBenjyDesktopfff.txt") WinWaitActive("fff - Notepad") AutoItSetOption("SendKeyDelay", 120) Send("ummm so this is supposed to be on a different line {enter} not sure what that means though." & @CRLF & "This should be on a new line!") WinClose("fff - Notepad") WinWaitActive("Notepad") Send("!s") MsgBox(0, "To Commander Atg", "Everything has been done as ordered Sir!", 4) BlockInput(0) Edited November 16, 2012 by BenjaminAlvarado Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 16, 2012 Moderators Share Posted November 16, 2012 Can you please show what you have in your Terminate function? Understand that the HotKeySet basically says "when you hit this letter (p, in your case), I am going to call this function (Terminate)". It can be as easy as this, but you need something in there: Func Terminate() Exit EndFunc "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
BenjaminAlvarado Posted November 16, 2012 Author Share Posted November 16, 2012 ohhh. . I thoughth the word "terminate" was it. I dind't know to set "terminate" to a funciton. . . ok thanks. I will odo that. 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