I'm trying to create a 4D form that will allow me to browse my server for a specific file, then once selected, have that file's path be displayed as a variable in the form. So far, I've been unsuccessful at even opening the Explorer window to browse for a file, but I'm also new to 4D overall.
Asked
Active
Viewed 292 times
1
-
What have you tried so far? We're more than happy to try and help, but you need to show you've put some effort into solving it yourself. Post the code you've tried, explain what's not working as you'd expect, and someone here can try and help you figure out how to fix it. Thanks. :-) – Ken White Jun 08 '12 at 15:03
-
1@KenWhite Well, my first instict was to try `OPEN EXTERNAL PROCESS("C:\\WINDOWS\\explorer.exe"), however that wouldn't allow for a selected path to be turned into a variable. From there, I've been searching the Language reference, but I can't find much information there that would help me out. – SirSkidmore Jun 08 '12 at 15:56
1 Answers
2
Take a look at the Select Document command.
The Select document command displays a standard open document dialog box which allows the user to set one or more files and returns the name and/or full access path of the selected file(s).
The link is for 4Dv13, but it should be similar for v11 and v12.
If you want to have immediate access to the contents use Open Document instead.
Edit to add Code example
C_TEXT($tFirstFileSelected) // this doesn't seem to be getting filled
C_TEXT(tFileNamePlusPath) // use process var to display on form (can't use local)
ARRAY TEXT($atFilesSelected;0) // local array to hold all paths for file(s) selected
Select document("";"*";"Pick File";0;$atFilesSelected;$tFirstFileSelected)
// if only one file is selected the path will be in the first array element
tFileNamePlusPath:=$atFilesSelected{1}

Joshua Hunter
- 515
- 4
- 8
-
1That worked perfectly, except for the fact that it doesn't show the full path of the file selected, but it's an immediate start! Thank you very much for your help! Not a huge fan of 4D, I have to be honest with you, haha. – SirSkidmore Jun 08 '12 at 18:40
-
1Thank you! It works well, I really appreciate it. Today is the first day I've done 4D stuff, I'm more of a Rails/4D guy. – SirSkidmore Jun 08 '12 at 20:07