Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting popups in an if statement
#1
Hello,

Ive been looking at this code for so long i cant see the wood for the trees. Anyone spot my simple mistake?

The macro is supposed to go: if window of type popup exists.... do this, else do this....

int h = win(571 460) //location of the popup
ifi win(h "" "" 8 ) // 8 flag code for must be popup
do this
else
do this

Any help would really help me out

Cheers

AndySmile
#2
First argument of win is window name, not handle (win itself returns window handle). Other syntax - win(x y).

If you have window handle and want to check whether it is popup, get window style and check for WS_POPUP flag.

Code:
Copy      Help
[color=blue]int [/color]h = [color=blue]win[/color](571 460)
[color=blue]if[/color](GetWinStyle(h)&WS_POPUP)
,[color=blue]out [/color]"yes"
[color=blue]else[/color]
,[color=blue]out [/color]"no"
#3
When using this though the 'out' expects a string to follow rather than a variable to start the next task.

int h = win(571 460)
if(GetWinStyle(h)&WS_POPUP)
,,,,OUT lef 201 59 "Microsoft Excel - test.xls
,,,,'L Ce.........
Else
.....OUT lef 286 170 "UNI-work"......

is there a way of getting around this?

Thanks once again for your help

Andy
#4
Here out is only for example. Use it only to view what happens.

int h = win(571 460)
if(GetWinStyle(h)&WS_POPUP)
,lef 201 59 "Microsoft Excel - test.xls"
,'L Ce.........
else
,lef 286 170 "UNI-work"; ......
#5
EXCELLENT!!!!

My only niggle now is that the repeat funtion at the top of my macro only runs on the 'else' option at the bottom of the script, If the if statment in the middle of the scriptis true it does not return to the top os the script to repeat again. Sure ill figure it eventually

Thanks for all your help!

Andy
#6
EXCELLENT!!!!

My only niggle now is that the repeat funtion at the top of my macro only runs on the 'else' option at the bottom of the script, If the if statment in the middle of the scriptis true it does not return to the top os the script to repeat again. Sure ill figure it eventually

Thanks for all your help!

Andy


Forum Jump:


Users browsing this thread: 2 Guest(s)