Sign in to follow this  
Followers 0
cypher175

@ScriptDrive...?

11 posts in this topic

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:\

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Compiled

there!

Both work fine :mellow:

Edited by Jon

tolle indicium

Share this post


Link to post
Share on other sites

cool, than you..!!

Share this post


Link to post
Share on other sites

$split=stringsplit(@scriptdir,"\")
msgbox(0,"directory",$split[1])oÝ÷ Ù'+ZºÚ"µÍÌÍÜÜ]Ý[ÜÜ]
]]Ú]^K ][ÝÉÌLÉ][ÝÊBÙØÞ
    ][ÝÙXÝÜI][ÝË  ÌÍÜÜ]ÌWJ

Compiled

there!

Both work fine :mellow:

Mine's shorter , hehe :(

Share this post


Link to post
Share on other sites

Mine's shorter , hehe :mellow:

Yours doesn't have a mesasgebox :(

tolle indicium

Share this post


Link to post
Share on other sites

#7 ·  Posted (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)

:mellow:

Edit: Easier with _PathSplit()

Edited 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

Share this post


Link to post
Share on other sites

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)

:mellow:

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 .

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

ConsoleWrite(_ScriptDrive() & @CRLF)

Func _ScriptDrive()
    Return StringRegExpReplace(@ScriptDir, "^(\w+:)(.*?\z)|^((?:\\\\|//).*?)([\\/].*?\z)", "\1\3")
EndFunc

Edited 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.

Share this post


Link to post
Share on other sites

ConsoleWrite(_ScriptDrive() & @CRLF)

Func _ScriptDrive()
    Return StringRegExpReplace(@ScriptDir, "^(\w+:)(.*?\z)|^((?:\\\\|//).*?)([\\/].*?\z)", "\1\3")
EndFunc
Another 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.

Share this post


Link to post
Share on other sites

This is a lucky guy to get so many solutions o.O .

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0