Jump to content

Recommended Posts

Posted

Guys, I'm behind a router in a local LAN. I need a script to read my current WAN address and write it in the DESKTOP shortcut as follows:

CROWN.exe has a shortcut on the desktop named "Crown". So if the script learns my current WAN is 83.146.26.254 it writes it down in the shortcut's text on the desktop as "Crown -83.146.26.254". Any ideas, please?

Many thanks.

Posted

Guys, I'm behind a router in a local LAN. I need a script to read my current WAN address and write it in the DESKTOP shortcut as follows:

CROWN.exe has a shortcut on the desktop named "Crown". So if the script learns my current WAN is 83.146.26.254 it writes it down in the shortcut's text on the desktop as "Crown -83.146.26.254". Any ideas, please?

Many thanks.

there are a hundred websites that will tell you your ip address. go to one and parse the result.

alternate method....

if you have a web server you own, hit it with a funky nonexistent web page, then parse the log for the source ip of the offending hit....

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Posted

Guys, I'm behind a router in a local LAN. I need a script to read my current WAN address and write it in the DESKTOP shortcut as follows:

CROWN.exe has a shortcut on the desktop named "Crown". So if the script learns my current WAN is 83.146.26.254 it writes it down in the shortcut's text on the desktop as "Crown -83.146.26.254". Any ideas, please?

Many thanks.

This does what you want:

$oHTTP = ObjCreate("Microsoft.XMLHTTP")
$oHTTP.Open("GET", "http://www.whatismyip.org/", False)
$oHTTP.Send()
$oIP = $oHTTP.ResponseText
FileMove(@DesktopDir&"\CROWN.lnk",@DesktopDir&"\CROWN -"&$oIP&".lnk")
Posted

This does what you want:

$oHTTP = ObjCreate("Microsoft.XMLHTTP")
$oHTTP.Open("GET", "http://www.whatismyip.org/", False)
$oHTTP.Send()
$oIP = $oHTTP.ResponseText
FileMove(@DesktopDir&"\CROWN.lnk",@DesktopDir&"\CROWN -"&$oIP&".lnk")
Thank you, Nahuel, will try it now.
Posted (edited)

This does what you want:

$oHTTP = ObjCreate("Microsoft.XMLHTTP")
$oHTTP.Open("GET", "http://www.whatismyip.org/", False)
$oHTTP.Send()
$oIP = $oHTTP.ResponseText
FileMove(@DesktopDir&"\CROWN.lnk",@DesktopDir&"\CROWN -"&$oIP&".lnk")

Excellent, Nahuel! It works and the code is very short.

Just one note: turns out I need to ENTER my WAN IP not in the CROWN.lnk but in the properies of the CROWN.lnk as follows:

(EXAMPLE)

In Crown Properties > Shortcut>

Target: C:\Program Files\Crown\Crown.exe -83.146.26.254

I guess it should be easy now, but I only guess, have no idea how to call on that Target box in the Properties>Shortcut.

Edited by Dirk98
Posted

Excellent, Nahuel! It works and the code is very short.

Just one note: turns out I need to ENTER my WAN IP not in the CROWN.lnk but in the properies of the CROWN.lnk as follows:

(EXAMPLE)

In Crown Properties > Shortcut>

Target: C:\Program Files\Crown\Crown.exe -83.146.26.254

I guess it should be easy now, but I only guess, have no idea how to call on that Target box in the Properties>Shortcut.

read the manual.......FileCreateShortCut()

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Posted

read the manual.......FileCreateShortCut()

Thanks flyingboz, will this command create new shortcuts every time it will find that the IP has changed? I need only one instance of this shortcut on the desktop.

I'll try in the meantime.

Thanks.

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
  • Recently Browsing   0 members

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