Sign in to follow this  
Followers 0
BenjaminAlvarado

123 guide help - Exiting scripts

9 posts in this topic

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!

Share this post


Link to post
Share on other sites



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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.”

 

Share this post


Link to post
Share on other sites

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.”

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by BenjaminAlvarado

Share this post


Link to post
Share on other sites

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

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

ohhh. . I thoughth the word "terminate" was it. I dind't know to set "terminate" to a funciton. . . ok thanks. I will odo that.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0