Post by xxgeek on Jul 15, 2021 21:59:43 GMT
We could do this for making a folderdialog.
Write script to file, then run the script.
Just proof of concept right now, (not saving the path to variable yet)
Paste into JB IDE, save file, then run it
' Based on the Hey Scripting Guys article
' "How Can I Show Users a Dialog Box That Only Lets Them Select Folders?"
' www.microsoft.com/technet/scriptcenter/resources/qanda/jun05/hey0617.mspx
'
' Function written by Rob van der Woude
' www.robvanderwoude.com
nomainwin
q$=chr$(34)
FolderDialog$ = "FolderDialog.vbs"
open FolderDialog$ for output as #1
#1, "WScript.Echo BrowseFolder( ";q$;"My Computer";q$;", False )"
#1, "Function BrowseFolder( myStartLocation, blnSimpleDialog )"
#1, " Const MY_COMPUTER = &H11&"
#1, " Const WINDOW_HANDLE = 0"
#1, " Dim numOptions, objFolder, objFolderItem"
#1, " Dim objPath, objShell, strPath, strPrompt"
#1, " strPrompt = ";q$;"Select a folder:";q$
#1, " If blnSimpleDialog = True Then"
#1, " numOptions = 0"
#1, " Else"
#1, " numOptions = &H10&"
#1, " End If"
#1, " Set objShell = CreateObject( ";q$;"Shell.Application";q$;" )"
#1, " If UCase( myStartLocation ) = ";q$;"MY COMPUTER";q$;" Then"
#1, " Set objFolder = objShell.Namespace( MY_COMPUTER )"
#1, " Set objFolderItem = objFolder.Self"
#1, " strPath = objFolderItem.Path"
#1, " Else"
#1, " strPath = myStartLocation"
#1, " End If"
#1, " Set objFolder = objShell.BrowseForFolder( WINDOW_HANDLE, strPrompt, _"
#1, " numOptions, strPath )"
#1, " If objFolder Is Nothing Then"
#1, " BrowseFolder = ";q$;q$
#1, " Exit Function"
#1, " End If"
#1, " Set objFolderItem = objFolder.Self"
#1, " objPath = objFolderItem.Path"
#1, " BrowseFolder = objPath"
#1, "End Function"
close #1
run "cscript /nologo ";FolderDialog$