Cybertek Posted February 23, 2009 Share Posted February 23, 2009 Is there a way to get the name of a server that is mapped. The drive letter is always the same but the length of the server name is nerver the same. Here is what I got to work if the server name is a set length.....there has to be an easier way. $var = RegRead("HKEY_CURRENT_USER\Network\P", "RemotePath") MsgBox(0,"done", $var) $var2 = stringmid($var, 3, 10) MsgBox(0,"Server", $var2) thanks, cybertek Link to comment Share on other sites More sharing options...
Bert Posted February 23, 2009 Share Posted February 23, 2009 Have you looked in the registry? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Cybertek Posted February 23, 2009 Author Share Posted February 23, 2009 Have you looked in the registry?come on man look at the code i posted$var = RegRead("HKEY_CURRENT_USER\Network\P", "RemotePath")from \\servername001\personaldata\folderI need to get the part servername001 with out the backslashes Link to comment Share on other sites More sharing options...
Authenticity Posted February 23, 2009 Share Posted February 23, 2009 #include <Array.au3> #include <String.au3> Dim $sServer = '\\servername001\personaldata\folder' Dim $Match = _StringBetween($sServer, '\\\\', '\\', -1, 1) If IsArray($Match) Then _ArrayDisplay($Match) $Match = StringRegExp($sServer, '(?<=\\\\)([^\\]*)', 1) If IsArray($Match) Then _ArrayDisplay($Match) Dim $iStart = StringInStr($sServer, '\\') + 2 Dim $iEnd = StringInStr($sServer, '\', 0, 1, $iStart) If $iStart And $iEnd Then $Match = StringMid($sServer, $iStart, $iEnd-$iStart) MsgBox(0x10, 'Title', 'Match: ' & $Match) EndIf Exit ? Link to comment Share on other sites More sharing options...
Bert Posted February 23, 2009 Share Posted February 23, 2009 I didn't read it first... The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Cybertek Posted February 23, 2009 Author Share Posted February 23, 2009 #include <Array.au3> #include <String.au3> Dim $sServer = '\\servername001\personaldata\folder' Dim $Match = _StringBetween($sServer, '\\\\', '\\', -1, 1) If IsArray($Match) Then _ArrayDisplay($Match) $Match = StringRegExp($sServer, '(?<=\\\\)([^\\]*)', 1) If IsArray($Match) Then _ArrayDisplay($Match) Dim $iStart = StringInStr($sServer, '\\') + 2 Dim $iEnd = StringInStr($sServer, '\', 0, 1, $iStart) If $iStart And $iEnd Then $Match = StringMid($sServer, $iStart, $iEnd-$iStart) MsgBox(0x10, 'Title', 'Match: ' & $Match) EndIf Exit ? Well I don't entirely understand it but this is essentially what I was looking for Dim $Match = _StringBetween($sServer, '\\\\', '\\', -1, 1) $Match = StringRegExp($sServer, '(?<=\\\\)([^\\]*)', 1) these are the two lines that confuse me(more along the lines the the argument for the pattern) any chance you could maybe explain it a little to me thanks so much for the help, Cybertek Link to comment Share on other sites More sharing options...
BrettF Posted February 23, 2009 Share Posted February 23, 2009 Hi Mate, First things first, have you even looked at the helpfile for those functions? Once you've done that you should understand whats happening a little better... Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now