Jump to content

Recommended Posts

Posted

Does anyone know how to obtain the name of the current folder in which an autoit script is being run? (both the fully qualified name and the name of the current level only: for example "c:\program files\abc corporation\myapp" in the case of the former and just "myapp" in the case of the latter).

I have looked up all the functions, macros and user add-ons but I cannot see how to obtain this information.

Computers don't solve problems, they just rearrange them.New string TRIM() functions for AutoIt3

Posted (edited)

Hmm.... The macros to try would be

@ScriptDir

or

@WorkingDir

MsgBox(4096,"Example", "The script is running from folder " & @ScriptDir)

Edit: For just the current folder level, you could try http://www.autoitscript.com/fileman/users/Valik/path.au3 or maybe

$p = StringSplit(@ScriptDir,"\")
MsgBox(4096,"folder", $p[$p[0]] )

OR if using the latest unstable version of Autoit

$q = StringTrimLeft(@ScriptDir, StringInStr(@ScriptDir, "\", 0, -1))
MsgBox(4096,"folder", $q)
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

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
×
×
  • Create New...