Opening a folder in Windows Explorer
BlitzMax Forums/BlitzMax Programming/Opening a folder in Windows Explorer
| ||
I'm trying to get my program to open a specific folder in the Windows Explorer. I can't figure out how to do it. I found mention of CreateProcess and System_ on these forums, but the program just seems to ignore them. Sending the extract same string that I am using with these commands to the 'Run...' dialogue in Windows works (it's basically just a full folder path), I'd just like my program to do it automatically. Any advice, anyone? |
| ||
Sending the extract same string that I am using with these commands to the 'Run...' dialogue in Windows works Haven't tested it, but have you tried "explorer <pathname>" instead? |
| ||
Strict Framework Brl.Blitz Import PUB.FreeProcess Local Proc:TProcess = TProcess.Create("explorer c:", 0) Delay 6000 Proc.Terminate() End does this do it? |
| ||
Flame, I tried that, and curiosly it tells me the path doesn't exist. Same when I do it from the Run... dialogue, and yet the path on it's own works fine. |
| ||
Did that program not work? Post your code so we can give it a try. |
| ||
Sorry, tony, haven't got to it, yet. I'll try it in just a minute. |
| ||
This is basically what I'm doing, it's just tagged onto the end of my program, right before it ends:If Confirm("Would you like to go to the saved pictures folder?") System_("explorer "+AppDir$+"/pictures") DebugLog AppDir$+"/pictures" EndIf End The Debuglog entry is just to ensure that I'm putting in the right path. Minus the "explorer "+ part of the System_ command, the program quits fine, but without any acknowledgement or indication that the system command happened. With the "explorer "+ part it gives the error mentioned above. Oh, wait, maybe I need to put the argument in speechmarks or something. |
| ||
Flame, I tried that, and curiosly it tells me the path doesn't exist. Remember that if it contains spaces, you need to escape them, or enclose it in double-quotes. |
| ||
Ah, no, it's the '/' characters. Explorer doesn't seem to like them in the arguments, it prefers '\'. Yup, that fixed it. Adding "explorer" was the solution, thanks, guys! Bizarrely, while there is a space, it doesn't seem to need double quotes, it works fine. Which I wouldn't have expected. |
| ||
Just call [b]OpenURL(path){/b]. I.e.OpenURL("C:\Windows")will open explorer to the Windows directory. |