AlternateExistance Posted June 4, 2009 Share Posted June 4, 2009 Hi guys, I am more of a batch person but am migrating over to AutoIT as it is far more scalable, however i am currently having difficultly with a small problem. I am having trouble trying to determine the drive letter of a set variable which was set as a directory path. For eg, if $dest = 'Z:\TEMP FILES', how would i go about determining the drive that set variable was using was the Z drive? In batch i would have written the following: @ECHO OFF SET DEST=Z:\TEMP FILES CD /D %DEST% CD\ SET DRIVE=%CD% ECHO THE DRIVE LETTER OF %DEST% FOLDER IS: %DRIVE% Thanks, Liam Link to comment Share on other sites More sharing options...
JackDinn Posted June 4, 2009 Share Posted June 4, 2009 are you just wanting to get the "Z:" from the string? if so then use StringLeft($dest,2) Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
Inverted Posted June 4, 2009 Share Posted June 4, 2009 Hehe, yeah, you need to think more in a high-level-language mindframe, instead of batch programming. Batch programming is waayy too funky ! Link to comment Share on other sites More sharing options...
AlternateExistance Posted June 4, 2009 Author Share Posted June 4, 2009 Thanks JackDinn, that did the trick very nicely! Inverted, you are definitely right about that! Batch is funky but i am working towards getting into something with more meat - namely AutoIT. I have a long way to go it seems... Thanks again, Liam Link to comment Share on other sites More sharing options...
unixu Posted June 4, 2009 Share Posted June 4, 2009 (edited) are you just wanting to get the "Z:" from the string? if so then use StringLeft($dest,2) to get the patch from a var i would prefer pathsplit ^^ here a example #include <file.au3> #include <array.au3> Dim $szDrive, $szDir, $szFName, $szExt _PathSplit($var, $szDrive, $szDir, $szFName, $szExt) then you will get the path with $szDrive&"/"&$szDir more confinient and always returns the correct values :) Edited June 4, 2009 by unixu Link to comment Share on other sites More sharing options...
JackDinn Posted June 4, 2009 Share Posted June 4, 2009 (edited) yea sure but you just using the same command , if you look inside _PathSplit() you find := $drive = StringLeft($szPath, 2) so you dont really need to #Include all that extra stuff Edited June 4, 2009 by JackDinn Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
unixu Posted June 4, 2009 Share Posted June 4, 2009 well i dont like these stringleft and stringright stuff ^^ i like it to work with self written functions and those stringleft and right i cannot really use them in my function so i use the _pathsplit stuff 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