Jump to content

Variable trouble


Nova
 Share

Recommended Posts

I woz messing with this idea in notepad and I always seem to get $Ip_1 is not equal to $Ip_2

run ("""c:\program files\internet explorer\iexplore.exe"" http://whatismyip.com","",@SW_HIDE)
WinWait ("Your ip is")
$Title1 = WinGetTitle ("Your ip is")
WinClose ("Your ip is")
$Ip_1 = StringSplit ($Title1, " ")

sleep(2000)

run ("""c:\program files\internet explorer\iexplore.exe"" http://whatismyip.com","",@SW_HIDE)
WinWait ("Your ip is")
$Title2 = WinGetTitle ("Your ip is")
WinClose ("Your ip is")
$Ip_2 = StringSplit ($Title2, " ")


If $Ip_1 = $Ip_2 Then 
        MsgBox(4096, "Test", "Ip changed", 10)
    Else
        MsgBox(4096, "Test", "Ip unchanged", 10)
    EndIf

I have also changed the line

If $Ip_1 = $Ip_2 Then
to
If $Ip_1 = $Ip_1 Then

But I still get a return saying the 2 varibles are not equal.

What am I doing wrong ?

Edited by nova
Link to comment
Share on other sites

  • Administrators

I woz messing with this idea in notepad and I always seem to get  $Ip_1 is not equal to $Ip_2

run ("""c:\program files\internet explorer\iexplore.exe"" http://whatismyip.com","",@SW_HIDE)
WinWait ("Your ip is")
$Title1 = WinGetTitle ("Your ip is")
WinClose ("Your ip is")
$Ip_1 = StringSplit ($Title1, " ")

sleep(2000)

run ("""c:\program files\internet explorer\iexplore.exe"" http://whatismyip.com","",@SW_HIDE)
WinWait ("Your ip is")
$Title2 = WinGetTitle ("Your ip is")
WinClose ("Your ip is")
$Ip_2 = StringSplit ($Title2, " ")
If $Ip_1 = $Ip_2 Then 
        MsgBox(4096, "Test", "Ip changed", 10)
    Else
        MsgBox(4096, "Test", "Ip unchanged", 10)
    EndIf

I have also changed the line

If $Ip_1 = $Ip_2 Then
to
If $Ip_1 = $Ip_1 Then

But I still get a return saying the 2 varibles are not equal.

What am I doing wrong ?

You can't compare arrays like that (stringsplit returns an array not a single variable). Try doing the compare before you string split each one (that is when it is still a simple string)
Link to comment
Share on other sites

Nova do you mind my knowing what you are trying to do? I have a script that grabs an ip address if it is different, and then it emails the new one to you.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Actually my Idea is very simular

I want my ip address to be checked every lets say 1 minute and if it changes, The new ip address is sent as a txt msg to my mobile phone !

Im still working on the idea Im pretty sure that www.meteor.ie let you send free txt msgs from your computer to ur phone !

Heres what I have so far

Break(0)
Opt("TrayIconHide", 1) 

while 1
 sleep(10) 
wend 

run ("""c:\program files\internet explorer\iexplore.exe"" http://whatismyip.com","",@SW_HIDE)
WinWait ("Your ip is")
$Title1 = WinGetTitle ("Your ip is")
WinClose ("Your ip is")
$Ip_1 = StringSplit ($Title1, " ")

sleep(60000)

run ("""c:\program files\internet explorer\iexplore.exe"" http://whatismyip.com","",@SW_HIDE)
WinWait ("Your ip is")
$Title2 = WinGetTitle ("Your ip is")
WinClose ("Your ip is")
$Ip_2 = StringSplit ($Title2, " ")


If $Title1 = $Title2 Then 
       
    Else
       ClipPut($Ip_1[4])  
       $Ip = ClipGet()
       FileWriteLine("c:\Ip changes.txt","Your Ip has been changed for some unknown reason, here is your new Ip: "& $Ip)
    EndIf

As you can see at the moment the new ip is just stored to c:/Ip changes and is not sent as a txt msg to my phone because I have to ring the meteor customer careline in the morning to get my origional pin number that came with my phone inorder to use the free text msg service on there web site.

So I cant go any further untill 2morrow !

Anychance I can have alook at ur source ? Email was my second alternative !

Edited by nova
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...