Jump to content

Expanding directory name saved wrt to the running script


Recommended Posts

Greetings good folks

a simple question;

i have a variable defined for a folder path as;

$RateSheetDIR="..\..\input files\Rate Sheets\"

I want to use the variable in a script, say

MsgBox(0,"", $RateSheetDIR)

but I want to use omplete windows folder path;

c:\program files\autoit\samples\input files\Rate Sheets\

instead of the path I have given "..\..\input..."

any suggestions?

regards

Rishav

Edited by Rishav
Link to comment
Share on other sites

Sorry Manadar, but no. The previous topic contained no issue at all. It kept failing because of a stupid spelling mistake.

If you read the two, they are quite different, though they sound similar. I can see why you might have mistaken them to be the same.

anyway, I can't really use @scriptdir, @workingdir and such. I have just a folder path ".\..\etc" hand have to expand it to the full windows path.

Link to comment
Share on other sites

Maybe this:

Dim $sRelPath = InputBox('Working directory', _
    'Current working directory is: ' & @LF & '"' & @WorkingDir & '"', @WorkingDir & '\..', '', 400, 140)

If $sRelPath <> "" Then
    If StringLeft($sRelPath, 2) = '\.' Then
        MsgBox(0x40, 'Relative path', 'Relative path is:' & @LF & FileGetLongName($sRelPath & @WorkingDir, 1))
    Else
        MsgBox(0x40, 'Relative path', 'Relative path is:' & @LF & FileGetLongName($sRelPath, 1))
    EndIf
EndIf
Link to comment
Share on other sites

thank you guys.

@Authenticity; FileGetLongName sounds exactly like the command I am looking for. I'll check it out as soon as I reach home. Thanks again. :D

EDIt: ok my enthusiasm didn't really pan out. will have to take another look at what I am doing wrong.

a conceptual question. What exactly is the @workingdir? is it like a variable to which you can assign any directory path to?

Edited by Rishav
Link to comment
Share on other sites

@workingdir = Current/active working directory the script or compiled EXE is run from.

No you cannot assign anything to it or other macro constants.

Any word prefixed with an @ character is an AutoIt Macro, search help file for 'Macro'

a conceptual question. What exactly is the @workingdir? is it like a variable to which you can assign any directory path to?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...