Sign in to follow this  
Followers 0
Dirk98

Hard task

8 posts in this topic

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.

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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")

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#5 ·  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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Guys, thank you VERY much. Everyting works great! :)

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