"browse For File" In Prompt S’abonner

0
Avatar
Legacy Poster

Is there any way to allow the user to browse for a file path in the prompt design? For example, to go find a image. If I manually type or copy the path and file name, the format works, but users would love to be able to also browse for it. Thanks

4 commentaires

0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

Hi nRyder,
User prompt doesn't have a command button like Access form - you can only run script Before (OnPrePrompt) or After(OnPostPrompt / OnProcessData) event.
keep that in mind, you can try like..

Show file dialog before open prompt
[Code]
'Run in OnPreprompt
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "All Files|*.*"
objDialog.InitialDir = "C:\"
objDialog.ShowOpen
Value = objDialog.FileName
[/Code]

Or get list of image files in specific folder in dropdown box's VBScript.
[code]
'get list of PNG files in C:\images
Set fso = CreateObject("Scripting.FileSystemObject")
Set src = fso.GetFolder("C:\images\")
For Each file In src.Files
if Ucase(fso.GetExtensionName(file))="PNG" Then
options = options & fso.GetFileName(file) & vbTab & file & vbcrlf
End if
Next
Value=options
[/code]

Reference:
blogs.technet.com/b/heyscriptingguy/archive/2005/01/28/how-can-i-show-users-a-dialog-box-for-selecting-files.aspx

Hope that helps!
0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

I've been working on this, and got the drop-down option to work, sorta.

I wanted to let the user type or paste a folder path, and then allow the prompt dropdown script to use that entered path as it's path to pull file names from, but it always gives me a script error in the dropdown. If I set the field to "Screen Data", and enter the text before print-time, it works. But an InputBox put into the PrePrompt script doesn't seem to work.

Does that make sense?
0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

You can customize the script by changing the INPUT type=text to INPUT type=file so user can browse file, then write an onchange event to copy the value filename an hidden INPUT type=hidden element. Since the enctype of the form is not changed to "multipart/form-data" required for INPUT type=file, the file will not be uploaded.
0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

Hi nRyder,
Try specify path at the beginning of VBScript of Dropdown box source (OnFillList event).

Vous devez vous connecter pour laisser un commentaire.