Share this post

Link to post

Share on other sites

Melba23 2,661

Melba23 2,661

Not a good idea to start a new thread while the previous one is still open.

Now, we need a bit more than a single function to help you - no-one here is going to write all the other code around it to get it to work. So you post some code that shows your main loop and the functions you want to be interrupted and the function you want to do the interrupting and we will take a look.

When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button.

See you soon,

M23

P.S. And remove the unwelcome variable names before you post next time - we do notice these things you know!

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

Share this post

Link to post

Share on other sites

Stephen89 0

Stephen89 0

Not a good idea to start a new thread while the previous one is still open.

Now, we need a bit more than a single function to help you - no-one here is going to write all the other code around it to get it to work. So you post some code that shows your main loop and the functions you want to be interrupted and the function you want to do the interrupting and we will take a look.

When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button.

See you soon,

M23

P.S. And remove the unwelcome variable names before you post next time - we do notice these things you know!

ok thanks alot... so im still getting a hang of this right now so i will just attach my GUI code plus this function... this ain't my actual code yet i just want to get the hang of it..

when i press the first start button , it executes the a() function and because pixel detect will be @error then it will console write "error" when i try to interrupt in this state, it will interrupt. The problem comes in when pixel detect is NOT @error then it executes the command given, while executing the command and i press the interrupt button , it will wait for function a() to stop before _func2_() to execute...

Edited December 3, 2010 by Stephen89

Share this post

Link to post

Share on other sites

Melba23 2,661

Melba23 2,661

As it explains in the Wiki tutorial, you need to keep checking within the function if you want to interrupt. You were not doing this and so the function never looked for the flag and therefore never stopped.

I have commented out some of the code so that it runs on my machine - I do not anticipate problems when you uncomment it, but please come back if there are any. You can use the SetError line to simulate the returns from the PixelSearch command.

I also amended two of the label titles - you need to take more care when sanitising your scripts. That makes 2 strikes - do not do it a third time.

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

Share this post

Link to post

Share on other sites

Stephen89 0

Stephen89 0

As it explains in the Wiki tutorial, you need to keep checking within the function if you want to interrupt. You were not doing this and so the function never looked for the flag and therefore never stopped.

I have commented out some of the code so that it runs on my machine - I do not anticipate problems when you uncomment it, but please come back if there are any. You can use the SetError line to simulate the returns from the PixelSearch command.

I also amended two of the label titles - you need to take more care when sanitising your scripts. That makes 2 strikes - do not do it a third time.

M23

thank you very much, i'll check it right away and comment back if it's working.

last noobish question, what does return, return 0, return 1 mean? all i know is that return "exits the function"

sorry im new here

i've read about this in the help file "Use the Return keyword to exit the function. Unlike built-in functions, user-defined functions return 0 unless another return value is specified.

Note that function declarations cannot appear inside other function declarations." i didnt quite get it can you please explain? i want to use return but everytime i try to use return, it doesn't make any difference with or withoutit..

Edited December 5, 2010 by Stephen89

Share this post

Link to post

Share on other sites

Melba23 2,661

Melba23 2,661

When a built-in function returns, the return value is usually something of interest like an array or the value the function is designed to produce. User Defined Functions (UDFs) will, as the Help file states, return 0 unless you decide otherwise. You can use this return value to return an array or value just like a built-in function or to indicate whether the function was successful. Here is an example:

In the example above, we could not have written the functions like this:

; This is WRONG!!!Func Function_1($iA,$iB); This function returns a value - the sum of the 2 parametersReturn$iA+$iB; This is what you cannot do <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Func Function_2(); This built-in function we call here returns a success/failure value, which we repeatReturnGUICtrlSetBkColor($hLabel,0xFF0000)EndFuncEndFunc

Each function must be declared within its own Func...EndFunc statements - you cannot put another pair inside.

All clear?

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