Jump to content

Get IP address then execute script


Recommended Posts

Hello, I have an idea for a script, but I don't know how to proceed. Here is the basic logic that I would like to replicate in a simple autoit script:

Get IP address of local machine (from any of my two network adapters, Ethernet or wireless adapter)

IF IP = 10.*.*.* (in other words, if the ip matches the first octet of my work's DHCP range)

Then Execute script1

Else = Execute script2

EndIf

Exit

Simple huh? Not for a newb like me! Any suggestions would be greatly appreciated!

Link to comment
Share on other sites

Hello, I have an idea for a script, but I don't know how to proceed. Here is the basic logic that I would like to replicate in a simple autoit script:

Get IP address of local machine (from any of my two network adapters, Ethernet or wireless adapter)

IF IP = 10.*.*.* (in other words, if the ip matches the first octet of my work's DHCP range)

Then Execute script1

Else = Execute script2

EndIf

Exit

Simple huh? Not for a newb like me! Any suggestions would be greatly appreciated!

Please don't double-post.

Look in the helpfile at @ipaddress1, @ipaddress2, etc. You'll also probably want to look at StringLeft(). Past that, we're going to need to know more details. Are they really two scripts (that is, different files) that you want to conditionally execute? If it's possible, I'd recommend just using your If...Then statement to do different things.

If [your condition here] Then
  MsgBox(0,"Hi","I'm at work!")
Else
  MsgBox(0,"Hi","I'm not at work!")
EndIf
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
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...