zFrank Posted July 19, 2008 Share Posted July 19, 2008 hi, how can i open drive in which from my exe is running? for example if my exe is on desktop then it should run C:\ Else any other drive. i want it for all drives, i tried like this but it works only if the exe is in root of drive. like in C:\ not in C:\New\1 $Z = @ScriptDir If $Z= "C:\" Or "D:\" Then Run (Explorer.exe & $Z) EndIf Please reply as soon as possible. thanks in advance. [font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php$Life = "Happy" If @Error Then $Life = "Risk" Link to comment Share on other sites More sharing options...
TehWhale Posted July 19, 2008 Share Posted July 19, 2008 (edited) ShellExecute(StringLeft(@ScriptDir, 3))Explanation:ShellExecute will execute any file. If the passed parameter is a path, it will run explorer and then that path. StringLeft(@ScriptDir, 3) is saying get the first three characters in the path, which would be the root.Tested and works. Edited July 19, 2008 by Alienware Link to comment Share on other sites More sharing options...
zFrank Posted July 19, 2008 Author Share Posted July 19, 2008 but what if location of my exe is changed? can it work if the exe is running from any folder of a drive. it should open the main dir (root dir) of the drive. [font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php$Life = "Happy" If @Error Then $Life = "Risk" Link to comment Share on other sites More sharing options...
TehWhale Posted July 19, 2008 Share Posted July 19, 2008 (edited) but what if location of my exe is changed?can it work if the exe is running from any folder of a drive.it should open the main dir (root dir) of the drive.Did even you try it?Maybe you should read the bottom of my other post too.Tested and works. Edited July 19, 2008 by Alienware Link to comment Share on other sites More sharing options...
ProgAndy Posted July 19, 2008 Share Posted July 19, 2008 Did you see the macro @ScriptDir ?It points to the Directory in which the Script is located. the first 3 characters represent the DriveLetter with : and \ (e.g. could be A:\ or X:\ or C:\ ... ) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
zFrank Posted July 20, 2008 Author Share Posted July 20, 2008 this worked fine but did not maximized the window. now this one is working fine. Run("Explorer.exe" & (StringLeft(@ScriptDir, 3)), "", @SW_MAXIMIZE) thanks a lot for the help! [font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php$Life = "Happy" If @Error Then $Life = "Risk" Link to comment Share on other sites More sharing options...
BrettF Posted July 20, 2008 Share Posted July 20, 2008 Explorer.exe has other options too muttley MsgBox (0, "", "Example 1") $pid = Run ("Explorer.exe /select," & @ScriptFullPath) Sleep (5000) ProcessClose ($pid) MsgBox (0, "", "Example 2") $pid = Run ("Explorer.exe /e,/root," & @ScriptDir) Sleep (5000) ProcessClose ($pid) MsgBox (0, "", "Example 3") $pid = Run ("Explorer.exe /n," & @ScriptDir) Sleep (5000) ProcessClose ($pid) MsgBox (0, "", "Example 4") $pid = Run ("Explorer.exe /root," & @ScriptDir) Sleep (5000) ProcessClose ($pid) 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...
zFrank Posted July 20, 2008 Author Share Posted July 20, 2008 (edited) hey Bert, great to know about it. thanks for the information. you have really done a good work. can you provide some little info about these commands? thanks again... Edited July 20, 2008 by zFrank [font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php$Life = "Happy" If @Error Then $Life = "Risk" Link to comment Share on other sites More sharing options...
BrettF Posted July 20, 2008 Share Posted July 20, 2008 http://support.microsoft.com/kb/314853muttley 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...
zFrank Posted July 28, 2008 Author Share Posted July 28, 2008 @ BrettF Thanks! You are really great. [font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php$Life = "Happy" If @Error Then $Life = "Risk" Link to comment Share on other sites More sharing options...
mrmacadamia Posted May 26, 2009 Share Posted May 26, 2009 Hi guys, I'm new in AutoIT world. It's been a week though and I find it very interesting. Anyway, I have a trouble. I've been doing my homework by searching in the forum but I didn't find a clue about @ScriptDir @WorkingDir I read in the Help file but it is too simple but when I tried to understand how it works in the post above and I can't. I'm dumb i guess. Hope someone will explain to me how it works. thanks Link to comment Share on other sites More sharing options...
Authenticity Posted May 26, 2009 Share Posted May 26, 2009 (edited) You mean how conjunctionally (wrong word ) they work with the explorer.exe or what? If for example @ScriptDir is "C:\Scripts" and @ScriptFullPath is "C:\Scripts\New AutoIt v3 Script.au3" then they're just like %Variable% but do not require to be expanded: MsgBox (0, "", "Example 1") $pid = Run ("Explorer.exe /select," & @ScriptFullPath) ; $pid = Run ("Explorer.exe /select,C:\Scripts\New AutoIt v3 Script.au3") Sleep (5000) ProcessClose ($pid) MsgBox (0, "", "Example 2") $pid = Run ("Explorer.exe /e,/root," & @ScriptDir) ; $pid = Run ("Explorer.exe /e,/root,C:\Scripts") Sleep (5000) ProcessClose ($pid) MsgBox (0, "", "Example 3") $pid = Run ("Explorer.exe /n," & @ScriptDir) ; $pid = Run ("Explorer.exe /n,C:\Scripts") Sleep (5000) ProcessClose ($pid) MsgBox (0, "", "Example 4") $pid = Run ("Explorer.exe /root," & @ScriptDir) ; $pid = Run ("Explorer.exe /root,C:\Scripts") Sleep (5000) ProcessClose ($pid) Same with @WorkingDir, it's supposed to contain the @ScritpDir if run from the explorer or the current "C:\Path\Path" if run like "C:\Windows\System32>"C:\Scripts\New AutoIt v3 Script.au3" for example. Unlike @ScriptDir, it's possible to change to working directory using FileChangeDir() and then @WorkingDir contain the new working directory. .. and blah blah. Edited May 26, 2009 by Authenticity 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