cypher175 Posted November 16, 2008 Share Posted November 16, 2008 Is there any Macro Variable that can be used for the drive letter from where the script.exe is ran from Ex: C:\ D:\ F:\ Link to comment Share on other sites More sharing options...
Innovative Posted November 16, 2008 Share Posted November 16, 2008 $ScriptDrive = StringLeft(@ScriptDir, 3) Link to comment Share on other sites More sharing options...
Glyph Posted November 16, 2008 Share Posted November 16, 2008 (edited) Compiled there! Both work fine Edited July 22, 2009 by Jon tolle indicium Link to comment Share on other sites More sharing options...
cypher175 Posted November 16, 2008 Author Share Posted November 16, 2008 cool, than you..!! Link to comment Share on other sites More sharing options...
Innovative Posted November 16, 2008 Share Posted November 16, 2008 $split=stringsplit(@scriptdir,"\") msgbox(0,"directory",$split[1])oÝ÷ Ù'+ZºÚ"µÍÌÍÜÜ]Ý[ÜÜ] ]]Ú]^K ][ÝÉÌLÉ][ÝÊBÙØÞ ][ÝÙXÝÜI][ÝË ÌÍÜÜ]ÌWJ Compiled there! Both work fine Mine's shorter , hehe Link to comment Share on other sites More sharing options...
Glyph Posted November 16, 2008 Share Posted November 16, 2008 Mine's shorter , hehe Yours doesn't have a mesasgebox tolle indicium Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 17, 2008 Share Posted November 17, 2008 (edited) Neither covers the case of a script run from a UNC path: \\MyServer\MyShare\MyDir\MyScript.exe #include <File.au3> Global $sRoot, $sDir, $sFile, $sExt _PathSplit("X:\TestDir\TestSubDir", $sRoot, $sDir, $sFile, $sExt) MsgBox(64, "Test", "Drive root: " & $sRoot) _PathSplit("\\TestSvr\TestShare\TestDir\TestSubDir", $sRoot, $sDir, $sFile, $sExt) MsgBox(64, "Test", "UNC root: " & $sRoot) Edit: Easier with _PathSplit() Edited November 17, 2008 by PsaltyDS 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 Link to comment Share on other sites More sharing options...
Innovative Posted November 17, 2008 Share Posted November 17, 2008 Neither covers the case of a script run from a UNC path: \\MyServer\MyShare\MyDir\MyScript.exe #include <File.au3> Global $sRoot, $sDir, $sFile, $sExt _PathSplit("X:\TestDir\TestSubDir", $sRoot, $sDir, $sFile, $sExt) MsgBox(64, "Test", "Drive root: " & $sRoot) _PathSplit("\\TestSvr\TestShare\TestDir\TestSubDir", $sRoot, $sDir, $sFile, $sExt) MsgBox(64, "Test", "UNC root: " & $sRoot) Edit: Easier with _PathSplit() If he doesn't even know how to use StringLeft to find the drive, i think that's too profound for him . Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2008 Moderators Share Posted November 17, 2008 (edited) ConsoleWrite(_ScriptDrive() & @CRLF) Func _ScriptDrive() Return StringRegExpReplace(@ScriptDir, "^(\w+:)(.*?\z)|^((?:\\\\|//).*?)([\\/].*?\z)", "\1\3") EndFunc Edited November 17, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
martin Posted November 17, 2008 Share Posted November 17, 2008 ConsoleWrite(_ScriptDrive() & @CRLF) Func _ScriptDrive() Return StringRegExpReplace(@ScriptDir, "^(\w+:)(.*?\z)|^((?:\\\\|//).*?)([\\/].*?\z)", "\1\3") EndFuncAnother nice StringRegExpReplace for me to learn from, thanks SmOke_N. I have no doubt it took me longer to understand than it took you to write! Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Innovative Posted November 17, 2008 Share Posted November 17, 2008 This is a lucky guy to get so many solutions o.O . 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