Sign in to follow this  
Followers 0
6momo6

One little question about IF

19 posts in this topic

Ive got one question:

I want to make a IF sense but dont know exactly how to begin.

How can i write this: If cordinate 11, 62 isnt able to click Then restart script. start in a new beginninig.

thx in advance

-momo

Share this post


Link to post
Share on other sites



Ive got one question:

I want to make a IF sense  but dont know exactly how to begin.

How can i write this:  If  cordinate  11, 62  isnt able to click  Then restart script. start in a new beginninig.

thx in advance

-momo

<{POST_SNAPBACK}>

I am a little confused about what you are asking. All coordinates are clickable; the coordinate that is clicked may not do anything special, but you can click it. If by clicking that coordinate, something is supposed to happen, like a window popping up, you can do a WinWaitActive().

If WinWaitActive ("My Cool Window") Then MsgBox (0, "Yay!", "My Window Opened")

Please be more specific in what you are trying to do.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi dude

Thanx for your reply first.

Ive got SOO much ideas and i cannot explain how they are.

Yes they are clickable but i mean if the cordinate for example "X=12, Y=14" this is click able! But for a reason this coordinate isnt mopore click able the click button is empty so the script must just restart.

If 12,14 the button is empty then restart script // begin from 0. You get it what i mean?

-momo

Edited by Larry

Share this post


Link to post
Share on other sites

Yes Larry you helped me alot !! Now i need something how to bring the script to restart. If clickbuttonempty than restart script // begin from 0

Share this post


Link to post
Share on other sites

show us your script so we can see where/when/how to return to the begining

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

If WinWaitActive ("My Cool Window") Then MsgBox (0, "Yay!", "My Window Opened")

<{POST_SNAPBACK}>

This would be better written as:

winWaitActive("My Cool Window")
msgBox(0, "Yay!", "My Window Opened")

They are two separate commands with no relation -- when you don't specify a timeout for WinWaitActive(), it will never return false to prevent execution of the MsgBox().

Share this post


Link to post
Share on other sites

This would be better written as:

winWaitActive("My Cool Window")
msgBox(0, "Yay!", "My Window Opened")

They are two separate commands with no relation -- when you don't specify a timeout for WinWaitActive(), it will never return false to prevent execution of the MsgBox().

<{POST_SNAPBACK}>

Certainly disagree. The 2 separate commands are related to displaying if the WinWaitActive is True, then the messagebox will show. How do you get more related then that? The If statement is not incorrect.

Timeout or not, both will do the same, but what SerialKiller displays is a line that is more readable and applies more so in other similar approaches. ;)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hi thanx all for replay.

You didnt get exactly what im looking for ;)

AT the moment i cant post my scrippt here because its empty :P.

I just want to write a script like this :

If Clickbuttonempty(12,14)

then restartscript.

sounds very simple, its nothing about winactive thing!! Not any popup etc.. Someone know the command for restart a script ??

-momo

Edited by 6momo6

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I just want to write a script like this :

If Clickbuttonempty(12,14)

then restartscript.

You could wrap your entire script in a While..WEnd loop:

while (1)

   ; script lines
    if (buttonIsEmpty()) then continue
   ; script lines

   ; if you don't want the script to repeat at the end
    exitLoop

wEnd

Certainly disagree. The 2 separate commands are related to displaying if the WinWaitActive is True, then the messagebox will show. How do you get more related then that? The If statement is not incorrect.

Timeout or not, both will do the same, but what SerialKiller displays is a line that is more readable and applies more so in other similar approaches. ;)

<{POST_SNAPBACK}>

Not to cause an argument here -- just to learn more about others' views:

This use of WinWaitActive() here does not return a varying value. It always returns a true equivalent. To me it doesn't make sense to wrap something unconditionally true into an If statement -- it implies falsely that the WinWaitActive() command might return a false equivalent, and therefore prevent the message box from displaying -- which will never be the case.

I do agree that most of the time it is a good thing to wrap AutoIt functions in an If..Then construct (as almost every single function returns a boolean value). The only equivalent example I can come up with to this however is:

if msgBox(0, "Message Box", "With OK button only") then doWork()

Would you agree that this is a nonsensical use of If..Then (where MsgBox() will always return 1)? If so then how does it differ from the above example?

Edit: Missing comma from code.

Edited by LxP

Share this post


Link to post
Share on other sites

Thanx for the reply.

Its not what iam looking for. Should i ask Jon ???? He have to know, that ??

I cant believe about 1000 users here and no one can help me out.

its just a simple script.

IF Clickbuttonempty(12, 14)

Then restart script.

Its really as hard as say ??

-momo

ps.

Jon you has been received a PM *lol*

Share this post


Link to post
Share on other sites

Its not what iam looking for.

Do you even know what you are looking for, then? Based on your description, LxP provided you with enough information to get started.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

iTS not what iam looking for, whats your plan ?? to provocate me or what ??

LxP give me alot of information but its not for me .... thx anyway.

-momo

Edited by 6momo6

Share this post


Link to post
Share on other sites

Do you mean if the mouse cursor ISN'T over the button, therefore, the clickbutton is empty? If so...

While 1 = 1
   $Pos = GetMousePos()
   If $Pos[0] = 14 AND $Pos[1] = 16 Then 
      MsgBox(0,"Clickable!","This button is clickable!")
   EndIf
wEnd

Just a lil' somethin to get you on your way


Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Ok again i try my best to explain!

X=14 , Y=16 These are the xy cordinates. IF 14, 16 click Cordinate ISNT click able then exit script . reload script. Thats all!

If Clickbutton (14, 16) is empty then exit script. // reload after, i dont need any MSG box etc.. it should make all automaticly.

thx in advance

-momo

Edited by 6momo6

Share this post


Link to post
Share on other sites

Ok again i try my best to explain!

X=14 , Y=16  These are the xy cordinates.  IF 14, 16 click Cordinate ISNT click able then exit script .  reload script.  Thats all!

If Clickbutton (14, 16) is empty then exit script.  // reload after, i dont need any  MSG box etc..  it should make all automaticly.

thx in advance

-momo

<{POST_SNAPBACK}>

WHAT ???

again: WHAT ????

What is Clickbutton (14, 16)? What is Clickbutton()??

What do you mean by "If Clickbutton (14, 16) is empty"? What is "empty"???

What do you mean by "Cordinate ISNT click able"?

What do you mean by "i dont need any MSG box etc.. it should make all automaticly."?

I cant believe about 1000 users here and no one can help me out.

Well, I guess it's not the 1000 users, but your description of the problem.... Try to be more specific! What exactly are you trying to do?????

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Ok here i add a small pic: if this button as you see (pic) looks like this = buttonempty to reload the script.

Posted Image

Share this post


Link to post
Share on other sites

Ok here i add a small pic:  if this  button as you see (pic)  looks like this  = buttonempty  to reload the script.

Posted Image

What you need is PixelGetColor(), see help file sample and search the forum. To restart your script, use Run() and exit(). However, you'll have to compile your script for this!

Please try to understand what I said and come back with at least some code, before you ask further questions, otherwise the chances are rather high, that another 1000 users won't understand what you want.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

I know this code is really for laugh, I had no clue how to bring it right hehe.

glad for any help i get.

while 1
MouseClick("left", 506, 509)
   Do
Sleep(1300)
;Wait for page to finish loading
   Until  $oIE.busy = 0
MouseClick("left", 11, 62);back button
$coord = PixelSearch( 0, 0, 20, 300, 0xEBEBEC)
exit
run
wend

any Idea ?? I tested it didnt work ;)

Edited by 6momo6

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Sorry for this post now, i just wanted to make this topic UP :P

I did the pixelgetcolor thing and i type the color in the pixelsearch thing, i tested and no work huh ;)

Edited by 6momo6

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