Folders

BlitzPlus Forums/BlitzPlus Programming/Folders

Using the ExecFile command or something similar is there a way to us BlitzPlus to open a folder at the root directory of the blitz or exe file you are running?

What do you mean? Are you trying to, for instance, open a folder to be viewed in Windows Explorer? If so, then you might want to use the ExecFile command with some extra "command line" parameters - I'm not familiar with those myself, I think someone like Alaric or b32 should be able to help you out...

I think that you are looking for the currentdir$() command. Try this and see if it is what you want

print currentdir$()
waitkey()


To open the folder, you can "ExecFile" a folder, or run Explorer.

I want to open the current directory. The currentdir$() command would be perfect if I could use it to specify what folder to open with explorer. I don't know how to do that so help would be appreciated.

simply use ExecFile() and set the file$ parameter to CurrentDir()

like this
ChangeDir("c:")
ExecFile(CurrentDir())


What is ChangeDir("c:\") for?

I tested Senzak's code and it was very close, but I need the command to open the Current Directory. NOT the C drive.

Chr(34) is " character and is needed if parameter contains spaces.

Without quotes "C:\Program Files\BlitzPlus\tmp\" it will run file "C:\Program" with parameters "Files\BlitzPlus\tmp\"

Print "Opening current (" + CurrentDir$() + ") folder..."
ExecFile(Chr(34) + CurrentDir$() + Chr(34))

Print "Opening C:\ folder..."
ExecFile("c:")

Print "Opening BlitzBasic.com..."
ExecFile("http://www.blitzbasic.com")

Print "The End!"
WaitKey


You dont need the
ChangeDir("c:")
in there, it was only to show that it did indeed open the current folder. To just open the current folder, just use
ExecFile(CurrentDir())
....and i havn't tested it, but it looks like Andres advice with using
Chr(34)
at the beginning and end would help too


Hope this Helps....

I want to open the folder that an item is saved in, not the folder that it is running through. If this helps, I am making a small application like U3, but without using the U3 software and formatting

ExecFile(chr(34) + "x:\your\file is\saved\on\this device" + chr(34))


just change the drive name to whatever the device is connected to

I meant you could use ChangeDir() first to navigate to that folder, then when you used ExecFile(), it would open that folder

i have no idea what U3 is though

i didn't either, but i know how to use google ;)

http://en.wikipedia.org/wiki/U3

Another alternative is:
ExecFile "Explorer " + CurrentDir$()

Thank you so much that works perfect. Oh and as a side comment, if you add .exe after explorer it opens internet expolorer.

I think not. Command that opens IE is "iexplore", but "explorer" opens explorer

try it

start -> run -> "iexplore" = Internet Explorer
start -> run -> "explorer" = Explorer

have you tried it? I'm not sure if you know, but exefile and run are DIFFERENT!!!

Nope, I haven't tried it with ExecFile yet. I will when i get back to home.

EDIT:
Tried it now. They are different (maybe), but in this case they work the same as I told you.

it worked that way for me