MattyBed

Help with URL

4 posts in this topic

Hello guys, my english is bad so im sorry. I have here a sample code:

WinActivate  ("Mozilla Firefox")
Send("^l");; selects the address bar contents
Send("^c");; copies it to the clipboard
$sDomain = ClipGet()
If $sDomain="https://www.autoitscript.com/" "+suffix adress" Then
MsgBox(0, "Result", "True")
Else
    MsgBox(0, "Result", "False")
EndIf

What should I enter in "+suffix adress", if i want to see if the active window has the link?

Share this post


Link to post
Share on other sites



Hi and welcome,

Well, whatever comes after the:

"https://www.autoitscript.com/"

in that address bar you want to check

you have to write it like this though or it wont work:

If $sDomain="https://www.autoitscript.com/" & "forum/" Then

for instance...

or for this post we are in now would be:

"topic/184739-help-with-url/#comment-1326887"

Bill

Share this post


Link to post
Share on other sites
5 minutes ago, l3ill said:

in that address bar you want to check

Thank you for reply. So what can i do when in suffix adress are a random values? Example:

www.site.com/file/2345 then TRUE

www.site.com/other then FALSE

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

That sounds like a job for StringInString or regex (Regular Expression)

If  Not StringInStr($sDomain, "www.site.com/") =  0 Then
MsgBox(0, "Result", "True")
Else
    MsgBox(0, "Result", "False")
EndIf

for example...

Edited by l3ill

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