Jump to content

Recommended Posts

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

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.
  :)

Posted

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.

  • Developers
Posted

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?

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.
  :)

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...