Champak

Navigate folder structure

6 posts in this topic

#1 ·  Posted (edited)

I don't know how to exactly phrase this question but I'll try my best.

I have a folder named Folder 1, which contains two folders named AA and BB. My app was originally in Folder 1 calling a file in Folder AA. So the call was, @scriptdir\Folder AA. I now moved the app to Folder BB, but it still needs to call the file in Folder AA. How do I easily call for this file now without hard coding an entire file path?

 

Thanks.

Edited by Champak

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

from within Folder BB use relative path like this "..\Folder AA\file"

Edited by Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Thanks, it worked...somewhat. When I put the path as that, I get an error. It's to an avi file (or at least that one is the one I've noticed the problem with so far). The error shows the file and path is correct (it's compiled) stating (paraphrasing) that the avi is unable to play due to it being corrupted or something and I should try renstalling it. When I change the path to a full path it works. I tried requireAdmin and still have the same issue. When I get home later I'll put the exact error msg, but any ideas?

Share this post


Link to post
Share on other sites

This is the message I'm getting:

Title-----Bad Image

(full file path) is either not designed to run on Windows or it contains an error. Try installing the the program again using the original installation media or contact your system administrator r the software vendor for support. Error status 0xc000012f

 

This is how I'm calling it.

$GUI_RedLight = GUICreate("Red Light", 285, 40, 165, -427, $WS_POPUP, $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST)
    GUICtrlCreateAvi("..\AppImages\StopLightVid.avi", 0, 0, 0, 285, 40, $ACS_AUTOPLAY)
GUISetState()

 

Now when I put a full file path it works.

Share this post


Link to post
Share on other sites

Hi Champak,

Relative locations will not work for what you need it for, is it imperative that you have a flexible folder structuring? what I mean is are you likely to put the whole application on another computer in a folder other than the program files folder (like in someones documents for example) as that would change the folder destination. I might suggest that you have a look at the other folder options. Click here to see the options.

see if any of these will help with what your trying to do. using @MyDocumentsDir for example will give you 'C:\Users\User\Documents' from there you can just add the subfolders

Hope this helps a little.

Share this post


Link to post
Share on other sites

Yeah, I think you're right. I realized other things weren't working as well, databases, gifs. So I'm using one of the folder options as you suggest. Thanks.

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