Active Forums > Programs

Selecting a folder (a little vbs function)

(1/1)

euklides:
Little function to select a folder with VBS
(win systems)

--- Code: QB64: ---MYREP$ = REPSELECTOR$("D:"): Print MYREP$MYREP$ = REPSELECTOR$(""): Print MYREP$: SleepEnd Function REPSELECTOR$ (repertoiredemarrage$)    Repz$ = repertoiredemarrage$:  FS2$ = Chr$(13) + Chr$(10)    fs1$ = "Dim objFolder, objItem, objShell" + FS2$    fs1$ = fs1$ + "On Error Resume Next" + FS2$    fs1$ = fs1$ + "SelectFolder = vbNull" + FS2$    fs1$ = fs1$ + "myStartFolder = " + "²" + Repz$ + "²" + FS2$    fs1$ = fs1$ + "Set objShell  = CreateObject( ²Shell.Application² )" + FS2$    fs1$ = fs1$ + "Set objFolder = objShell.BrowseForFolder( 0, ²Select Folder², 0, myStartFolder )" + FS2$    fs1$ = fs1$ + "If IsObject( objfolder ) Then SelectFolder = objFolder.Self.Path" + FS2$    fs1$ = fs1$ + "Set WshShell = WScript.CreateObject(²WScript.Shell²)" + FS2$    fs1$ = fs1$ + "WshShell.Run ²cmd.exe /c echo ² & SelectFolder & ² | clip², 0, TRUE   " + FS2$    FS5: J = InStr(fs1$, "²"): If J > 0 Then Mid$(fs1$, J, 1) = Chr$(34): GoTo FS5    ficvbs$ = _CWD$ + "\TEMP_FS.vbs": CanalLibre% = FreeFile: Open ficvbs$ For Output As CanalLibre%    Print #1, fs1$: Close CanalLibre%: _Delay 0.1:    Shell ficvbs$: Kill ficvbs$    REPSELECTOR$ = _Clipboard$End Function 

Navigation

[0] Message Index

Go to full version