Archives Forums/BlitzPlus Programming/Folders

Petron(Posted 2007) [#1]
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?

Adam Novagen(Posted 2007) [#2]
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...

Alaric(Posted 2007) [#3]
I think that you are looking for the currentdir$() command. Try this and see if it is what you want

print currentdir$()

b32(Posted 2007) [#4]
To open the folder, you can "ExecFile" a folder, or run Explorer.

Petron(Posted 2007) [#5]
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.

Senzak(Posted 2007) [#6]
simply use ExecFile() and set the file$ parameter to CurrentDir()

like this

Petron(Posted 2007) [#7]
What is ChangeDir("c:\") for?

Petron(Posted 2007) [#8]
I tested Senzak's code and it was very close, but I need the command to open the Current Directory. NOT the C drive.

Andres(Posted 2007) [#9]
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..."

Print "Opening"

Print "The End!"

Senzak(Posted 2007) [#10]
You dont need the format_code('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 format_code('ExecFile(CurrentDir())')....and i havn't tested it, but it looks like Andres advice with using format_code('Chr(34)') at the beginning and end would help too

Hope this Helps....

Petron(Posted 2007) [#11]
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

Andres(Posted 2007) [#12]
format_code('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

Senzak(Posted 2007) [#13]
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

Andres(Posted 2007) [#14]
i didn't either, but i know how to use google ;)

b32(Posted 2007) [#15]
Another alternative is:
ExecFile "Explorer " + CurrentDir$()

Petron(Posted 2007) [#16]
Thank you so much that works perfect. Oh and as a side comment, if you add .exe after explorer it opens internet expolorer.

Andres(Posted 2007) [#17]
I think not. Command that opens IE is "iexplore", but "explorer" opens explorer

Petron(Posted 2007) [#18]
try it

Andres(Posted 2007) [#19]
start -> run -> "iexplore" = Internet Explorer
start -> run -> "explorer" = Explorer

Petron(Posted 2007) [#20]
have you tried it? I'm not sure if you know, but exefile and run are DIFFERENT!!!

Andres(Posted 2007) [#21]
Nope, I haven't tried it with ExecFile yet. I will when i get back to home.

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

Petron(Posted 2007) [#22]
it worked that way for me