Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
wait(2 w) and window not found
#1
Hi Gintaras,

In the macro below I get a Wait time out error despite the huge wait times and the fact that the window is already CA. (wait(2 WC w) does not change things)
Function Re_StartMIDI_OX
Code:
Copy      Help
int w=win("MIDI-OX*" "MIDIOX:Frame" "" 0x1)
run "$program files$\MIDIOX\midiox.exe"  "MIDIOX.ini" "" "C:\Users\GertAdmin\Documents\MIDI-OX\" ;;MIDI-OX
2
wait(2 w)

I have solved this by using a function instead of a wait, however I do not understand what the cause of the thrown error is.
Function WaitForWindowActive
Code:
Copy      Help
function ~windowName
int w
int i=20
rep 20
,0.1            ;;20*0.1=2sec
,i=i-1
,w=win(windowName)
,if w
,,break

if i=0
,OnScreenDisplay "(windowName) not found" 1  800 350

ret i   ;; if i=0 window not found

In this function: I am unable to find how to insert 'windowName' in such a way that it is repaced by its content in the onscreen text string.
Is this possible at all ?

Regards,

GertC
#2
Probably w is 0, ie win("MIDI-OX*" "MIDIOX:Frame" "" 0x1) did not find.
Your function is the same as
wait 2 WV windowName

I guess you need this:
Macro Macro1721
Code:
Copy      Help
run "$program files$\MIDIOX\midiox.exe" "MIDIOX.ini" "" "C:\Users\GertAdmin\Documents\MIDI-OX\" ;;MIDI-OX
2
int w=wait(2 WA win("MIDI-OX*" "MIDIOX:Frame" "" 0x1))

--------

OnScreenDisplay F"{windowName} not found" 1 800 350
#3
Thank you Gintaras, this works fine. I will be using this instead of my function.

F operator, I have now found that in the help.

Thanks a lot.
GertC


Forum Jump:


Users browsing this thread: 3 Guest(s)