Sign in to follow this  
Followers 0
aviaf

Using the If Function problems

3 posts in this topic

#1 ·  Posted (edited)

I want the mouse to click an apply settings button, and then click continue and then click on another tab in firefox, however the time for the settings to apply and click conitnue may differ and i dont want to lose time by making a long delay so i want it to click apply, then click continue, and if the site then goes to settings to click another tab, but if it clicked too quickly and its still at continue , then to delay 5 sec, and click at continue coordinates then click another tab, here's my coding so far:

MouseClick ( "left" , 635, 355 , 1 )

If WinActive( Basic Setup - Mozilla Firefox ) Then

MouseClick ( "left" , 125, 115 , 1 )

Endif

If WinActive( Mozilla Firefox ) Then

Sleep(5000)

MouseClick ( "left" , 635, 355 , 1 )

MouseClick ( "left" , 125, 115 , 1 )

EndIf

But it says error parsing function call, how do i fix it?

Edited by aviaf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

First off, it's throwing that Function error because your WinActive Syntax is incorrect.

WinActive("title","text")
The "txt" field CAN simply be left as quotes and it will skip the filter for text.

MouseClick ( "left" , 635, 355 , 1 )

If WinActive( Basic Setup - Mozilla Firefox ) Then

MouseClick ( "left" , 125, 115 , 1 )

Endif

If WinActive( Mozilla Firefox ) Then

Sleep(5000)

MouseClick ( "left" , 635, 355 , 1 )

MouseClick ( "left" , 125, 115 , 1 )

EndIf

Read a bit more about WinActive. Open your AutoIt Help file and look under Functions/Windows Management, should give you everything you need. :P

Edited by BinaryBrother

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

First off, it's throwing that Function error because your WinActive Syntax is incorrect.

Technically it is wrong, but only because he did not wrap it in "Double Quotes"

The text parameter is optional.

EDIT: Also, add

Opt("WinTitleMatchMode", 2)
to the top of your script so you can match windows by a substring of their text (Rather than the entire title) Edited by KentonBomb

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