Sign in to follow this  
Followers 0
Teldin

Function help

5 posts in this topic

#1 ·  Posted (edited)

HotKeySet('{F8}', '_ClickButton')


Func _ClickButton()

    GUICtrlSetData($status, "Hotkey pressed!")

    ControlClick(HWnd($pWin), '', $checkerror)

    If GUICtrlRead ($status) <> "ERROR!" then 

    ControlClick(HWnd($pWin), '', $nextaction)

    EndIf
EndFunc

I cannot get that function to wait for $checkerror before it runs $nextaction

Sleep does not work and I've tried to put them in seperate functions but it always runs to the end before looking at $checkerror.

I assume this is by design but how can I wait for $checkerror so $nextaction knows weather to run or not?

Edited by Teldin

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

HotKeySet('{F8}', '_ClickButton')
Func _ClickButton()

    GUICtrlSetData($status, "Hotkey pressed!")

    ControlClick(HWnd($pWin), '', $checkerror)

    If GUICtrlRead ($status) <> "ERROR!" then 

    ControlClick(HWnd($pWin), '', $nextaction)

    EndIf
EndFunc

I cannot get that function to wait for $checkerror before it runs $nextaction

Sleep does not work and I've tried to put them in seperate functions but it always runs to the end before looking at $checkerror.

I assume this is by design but how can I wait for $checkerror so $nextaction knows weather to run or not?

You are not clear on what you need to wait for...

Assume you click some button and then what happens ?

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

My hotkey copies highlighted text, clicks an GUI button to check for a specific format. If it matches a format ($checkerror), another button is pressed ($nextaction). If not, nothing should happen.

Unfortunately, the second button is always clicked because it only check for errors after the function has finished.

Share this post


Link to post
Share on other sites

My hotkey copies highlighted text, clicks an GUI button to check for a specific format. If it matches a format ($checkerror), another button is pressed ($nextaction). If not, nothing should happen.

Unfortunately, the second button is always clicked because it only check for errors after the function has finished.

Understood this part ... but how can you test for the first button press to be finished ?

Any unique text in the GUI or something that tells you the first button function ended?


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

>Any unique text in the GUI or something that tells you the first button function ended?

That's exactly what $status does. Shows ERROR if the $checkerror finds an error.

The problem is the first button does not execute until the end of the my function (_ClickButton)

It seems as if all the commands are queued until the function completes successfully, in which case all queued commands are executed in rapid sucession.

Edited by Teldin

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