Sign in to follow this  
Followers 0
yaos

Getting the name/IP address of a server the script is running from.

3 posts in this topic

#1 ·  Posted (edited)

Here's what I tried.

Regular expression, which I can't even begin to understand. ;)

I also tried the StringSplit function with @ScriptDir which returns correctly when run on my computer but does not work when running from the server, the array returns with multiple elements but they are all blank. I am using the correct forward slashes when I test on the server ( //servername/ ) . The @ScriptDir works correctly on the server, just not the StringSplit for some reason.

What I'm trying to do is find the server name, or IP address if there is no server name. For example, //coolserver/adirectory/anotherdirectory/lotsofdirectories and the server name would be "coolserver". I can then use the name to IP function to find the IP address if I need to do so.

Is there a simple way to get the server name that I passed over?

Edited by yaos

Share this post


Link to post
Share on other sites



Here's what I tried.

Regular expression, which I can't even begin to understand. ;)

I also tried the StringSplit function with @ScriptDir which returns correctly when run on my computer but does not work when running from the server, the array returns with multiple elements but they are all blank. I am using the correct forward slashes when I test on the server ( //servername/ ) . The @ScriptDir works correctly on the server, just not the StringSplit for some reason.

What I'm trying to do is find the server name, or IP address if there is no server name. For example, //coolserver/adirectory/anotherdirectory/lotsofdirectories and the server name would be "coolserver". I can then use the name to IP function to find the IP address if I need to do so.

Is there a simple way to get the server name that I passed over?

#Include <String.au3>

$sString = "\\SomeServer\SomeShare\SomeFolder"
$avPath = _StringBetween($sString, "\\", "\")

MsgBox(64, "Server", $avPath[0])

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#Include <String.au3>

$sString = "\\SomeServer\SomeShare\SomeFolder"
$avPath = _StringBetween($sString, "\\", "\")

MsgBox(64, "Server", $avPath[0])

;)

I tried so hard, but in the end it didn't even matter. Thank you very much.

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