Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clicking a button in a dialog
#1
Hi, I'm just started with this program and haven't got a clue really how to do things.
I understand that this question must have popped up before and I tried to search this forum part, but either missed it or didn't understand it.
Or rather, some parts I could understand, but not all.

I'm trying to figure out how to do two similar things when two program starts - clicking on a button.
The first button is activated on the dialog after 12 seconds.
If possible, I just want the dialogs to go away as soon as the buttons on them is active.
If that's not possible, I'm ok with a solution where both dialogs is closed after 12 seconds.
I think it's enough to just close the dialogs too, as soon as the buttons is active if that is easier.

This is from a recorded macro where I click the button when the button is active (after 12 seconds)
I'm sure it will work ok, but I'm really after a fully automated solution where it is done as soon as the button is activated.
#region Recorded 2015-10-06 15:56:36
int w2=win("gSyncit - Evaluation / Restricted Functionality" "WindowsForms10.Window.8.app.0.1b6501_r87_ad2")
lef 79 168 w2 1 ;;kommandoknapp 'Use Evaluation'
#endregion

Here is the dialog name from "Find window or control"
win("gSyncit - Evaluation / Restricted Functionality" "WindowsForms10.Window.8.app.0.1b6501_r87_ad2")

Here is the control
child("" "*.BUTTON.*" {window} 0x0 "wfName=button3")


The second one from "Find window or control"
The Window I want a control from:
int w=wait(30 WA win("PhraseExpress - Update Notification" "TUpdateDlg"))

The control I want to click when it's active
int w=wait(30 WA child("Skip this version" "TButton" {window}))

I really appreciate any help I can get.
#2
You probably use a window trigger. Then instead of
int wMain=win(...)
can be
int wMain=TriggerWindow
The first is correct too, but the second is more reliable and fast.

Then, I guess that the button is initially disabled. Then the macro can wait until it is enabled:
int wButton=wait(30 WE child("" "*.BUTTON.*" wMain 0x0 "wfName=button3"))

Then close the window:
clo wMain

Or, if want to click the button:
but wButton

If waiting for enabled button does not work, try dialog "Find image". There select "Wait"...
Also can wait for accessible object state, but in this case it probably would work only if waiting for enabled works.
#3
Thanks for your reply!

The following works fine once:
int wMain=win("gSyncit - Evaluation / Restricted Functionality" "WindowsForms10.Window.8.app.0.1b6501_r87_ad2")
int wButton=wait(30 WE child("" "*.BUTTON.*" wMain 0x0 "wfName=button3"))
but wButton

I don't know how to use TriggerWindow.
Should I add the properties in the "Item properties . Trigger - Window"? As what subtype (Created and active, Active etc.)?
Should I then replace "int wMain=win("gSyncit - Evaluation / Restricted Functionality" "WindowsForms10.Window.8.app.0.1b6501_r87_ad2")" with int wMain=TriggerWindow instead?

If I want the macro to be active even after the first run, how would I do that?
Or is this where a TriggerWindow fits?

Thanks again for your help!
#4
Quote:Should I then replace "int wMain=win("gSyncit - Evaluation / Restricted Functionality" "WindowsForms10.Window.8.app.0.1b6501_r87_ad2")" with int wMain=TriggerWindow instead?
Only this. But not necessary.

Quote:If I want the macro to be active even after the first run, how would I do that?
Properties -> Macro properties -> If a macro is running -> Run simultaneously.
#5
Great, it's up and running now. Just one problem left.
First:
I'm not shure what you meant by
Quote: Should I then replace "int wMain=win("gSyncit - Evaluation / Restricted Functionality" "WindowsForms10.Window.8.app.0.1b6501_r87_ad2")" with int wMain=TriggerWindow instead?
Only this. But not necessary.

I did put the window title and class in properties, isn't that necessary? I guess it is, and you meant something else.

Second:
I want it to run without having started Quick Macro.
I guess I need to make exe of the macros.
I have tried both to have the resources in the exefile and the resources in the folder, but it is not working.
If I start Quick Macros and run the exe from there it works.
I am administrator and have UAC turned off in Windows 7 64bit.
What is the trick?
#6
Exe does not have triggers. Instead you can use 'wait for window' in a loop somehow. Then don't use TriggerWindow.
#7
Ok, is there a simple alternative to exe's, as in running automatically at computer startup or user login?
I really don't want the complete Quick Macros environment to autostart.
Or do I need to change the macros to use another approach and then compile it to an exe?
#8
If you want to have window triggers, then some program must be running all the time. It can be QM, or it can be QM-created exe that waits for a window.
#9
Hi, I understand the need of something running in the background.
I found this thread: Trigger in Exe
How I should use it is beyond my abilities, but if you can provide a working example somewhere I'd be happy.
#10
example.
Toolbars sometimes don't launch


Forum Jump:


Users browsing this thread: 1 Guest(s)