craigey1 Posted February 11, 2007 Share Posted February 11, 2007 (edited) Hi All, I'm Having some difficulty Navigating Folders & was hoping someone could help out. I Have a directory structure something like: (please ignore the ".") ....<.......CD.........> ..|...........................\ ..|.............................\ ..|..............................\ Folder A................Folder B ..|...............................| SCRIPT .au3...........FILE.vbs I can get the current script path using "@ScriptDir", but I'm having difficulty trying to navigate to "Folder B". When I was using vbscript I was using the function INSTREV like so: UponeFolder_tmp = Left(script_path, InstrRev(script_path, "\")-1) UponeFolder = Left(UponeFolder_tmp, InstrRev(UponeFolder_tmp, "\")) Any ideas / advice as to how I can do this with AutoIT? Thanks in Advance Edited February 11, 2007 by craigey1 Link to comment Share on other sites More sharing options...
xcal Posted February 11, 2007 Share Posted February 11, 2007 Maybe something like this? $dir = @StartMenuDir MsgBox(0, 'Directory', $dir) $dirup1 = _upone($dir) MsgBox(0, 'Up One', $dirup1) Func _upone($arg) $ret = StringLeft($arg, StringInStr($arg, '\', 0, -1) - 1) Return $ret EndFunc You'll have to add error checking. PoojaKrishna and dogisay 2 How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
craigey1 Posted February 11, 2007 Author Share Posted February 11, 2007 Thanks will give it a shot tomorrow sometime, it's 2am & I've had enough of staring at my dodgy code! Time for bed! Link to comment Share on other sites More sharing options...
The Kandie Man Posted February 11, 2007 Share Posted February 11, 2007 Like this: Msgbox(0,'This will open "Folder B"',@Scriptdir & "\..\Folder B") Msgbox(0,"Text Data",FileRead(@Scriptdir & "\..\Folder B\Test.txt")) Place Test.txt in Folder B with a line of text and you will see that it works. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
xcal Posted February 11, 2007 Share Posted February 11, 2007 Works... that's pretty cool. How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
craigey1 Posted February 11, 2007 Author Share Posted February 11, 2007 Thanks Both of You. 2nd option is definately easier to use, though! Thanks again Link to comment Share on other sites More sharing options...
Bosse Posted February 11, 2007 Share Posted February 11, 2007 Ok, it sounds like it's solved, but I thought it would be interesting to mention that there's something simular in AutoIt as the "INSTREV" in VB StringInStr ( "string", "substring" [, casesense [, occurrence]] ) When you use the StringInStr function with a negative occurence it starts searching from the right of the string. Link to comment Share on other sites More sharing options...
xcal Posted February 11, 2007 Share Posted February 11, 2007 You mean like I already posted in #2? How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
tittoproject Posted February 12, 2007 Share Posted February 12, 2007 (edited) You should use the function "_PathFull": #include 'file.au3' $FullPath = _PathFull("..\Folder B", @Scriptdir) Msgbox(0, 'This will open "Folder B"', $FullPath)oÝ÷ Ù«¢+Øìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ì(ìÍÉ¥ÁÑ¥½¸è$QÉÑ̸¸ÀäÈìÌIÑÕɹÌÁÑ ÑÈÁɽÍÍ¥¹Ñ¡¥ÉѽÉ䡹½ÁÉѽȸ¸Ñ¼µ½ÙÑ¡ÁÑ ÕÀ(ì$$$$$$$%½¹±Ù°¸(ìMå¹Ñàè$$}AÑ¡Õ±° ÀÌØíÍI±Ñ¥ÙAÑ °ÀÌØíÍ ÍAÑ ô]½É¥¹¥È¤(ìAɵÑȡ̤è$ÀÌØíÍI±Ñ¥ÙAÑ ´Q¡ÁÑ Ñ¼ÁɽÍ̸(ì$$$$$$$ÀÌØíÍ ÍAÑ ÀÌØíÍQåÁ´ÍÁÑ Ñ¼ÕÍ¥¸Í½±ÕÑÁÑ ¥Ì¹½ÐÁɽ٥¸Q¡¥ÌÕ±ÑÌѼѡ(ì$$$$$$$%ÕÉɹÐݽɥ¹¥ÉѽÉä¸(ìIÅեɵ¹Ð¡Ì¤è9½¹(ìIÑÕɸY±Õ¡Ì¤èQ¡áÁ¹ÁÑ °Ñ¡É½½ÐÉ¥Ù½ÈÀÌØíÍ ÍAÑ Á¹¥¹½¸¡½Ü¥ÐÌäí̱±¸(ìÕÑ¡½È¡Ì¤è$%Y±¥¬¡=É¥¥¹°Õ¹Ñ¥½¸¹µ½¥¥Ñ¥½¸Ñ¼ÉÝɥѤ(ì$$$$$%Ñ¥ÑѽÁɽ©Ð¡IÝɥѤ(ì9½Ñ¡Ì¤è$$U9ÁÑ¡ÌÉÍÕÁÁ½ÉѸ(ì$$$$AÍÌÅÕ½ÐìÀäÈìÅÕ½ÐìѼÐѡɽ½ÐÉ¥Ù½ÀÌØíÍ ÍAÑ ¸(ì$$$$AÍÌÅÕ½ÐìÅÕ½Ðì½ÈÅÕ½Ðì¸ÅÕ½ÐìѼÉÑÕɸÀÌØíÍ ÍAÑ ¸(ì$$$$ɱѥÙÁÑ Ý¥±°Õ¥±ÐɱѥÙѼÀÌØíÍ ÍAÑ ¸Q¼åÁÍÌÑ¡¥Ì¡Ù¥½È°Õ͸ͽ±ÕÑÁÑ ¸(ì(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô Edited February 12, 2007 by tittoproject 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