Sign in to follow this  
Followers 0
Ram

Directory

4 posts in this topic

Hi,

I have three folder and subfolder...

Main folder: (which stores the excel file)

D:\Finance\

Sub folder: (Which stores the script)

D:\Finance\OneWay\

D:\Finance\TwoWay\

D:\Finance\Final\

Sub folder: (which stores the output text file)

D:\Finance\OneWay\Output

D:\Finance\TwoWay\Output

D:\Finance\Final\Output

The main folder has one universal excel file and sub folder has the scripts. I have written a function such that the excel file is read and according to option the script is excuted from the sub folders and finally stores the out put on a text file in the corresponding output folder.

In each script i have written the full path for reading the excel file and storing the text file in output folder.

Now the problem is that when I move the folder to different location I have to edit the path in the script everytime so that it reads the correct location..

How do you think I can solve this issue?

I need to read the path so that the universal excel file is opened and same time I read the path so that it gets saved to output folder which is in the subfolders..

For saving text file to out folder location I think i can use

@scriptDir & "\output\"
because the script is excuted from the sub folder.. I don't know what should be used for reading the excel from the main folder? Is there any command for it?

It would be really great if someone can help me out?

Thanks in advance!

Share this post


Link to post
Share on other sites



Contemplate the demo...

$sPath = @ScriptDir
$sPathParent = FileGetLongName($sPath & "\..", 1)
$sPathGrandParent = FileGetLongName($sPath & "\..\..", 1)

ConsoleWrite("Debug: $sPath = " & $sPath & @LF & _
        "Debug: $sPathParent = " & $sPathParent & @LF & _
        "Debug: $sPathGrandParent = " & $sPathGrandParent & @LF)

:)


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

Contemplate the demo...

$sPath = @ScriptDir
$sPathParent = FileGetLongName($sPath & "\..", 1)
$sPathGrandParent = FileGetLongName($sPath & "\..\..", 1)

ConsoleWrite("Debug: $sPath = " & $sPath & @LF & _
        "Debug: $sPathParent = " & $sPathParent & @LF & _
        "Debug: $sPathGrandParent = " & $sPathGrandParent & @LF)

:)

Thanks a lot PsaltyDS and smashly....this worked..!!

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