[VBS or C] File/Folder List Dialog Box
greg6614
Posted messages
629
Status
Member
-
greg6614 Posted messages 629 Status Member -
greg6614 Posted messages 629 Status Member -
Hello to you, I’m developing a small batch app for personal use for file backups and inside I want to call 2 programs, if possible in VBS. The first opens a dialog box to choose the destination folder for the backup, for that one no problem I found the source code on the net that I adapted to batch, and for the second I would like to show a dialog box allowing to list to be able to choose the files and/or folders to backup.
I don’t know anything about VBS or C, which is why I’m turning to you. If you have a solution, preferably in VBS I’ll take it, otherwise if it’s in C I’ll take it too but you’ll need to test by compiling to make an external command.
Thanks in advance for your help and have a good day :)
Configuration: Windows 7 / Firefox 20.0
--
Hope I helped you
Greg
I don’t know anything about VBS or C, which is why I’m turning to you. If you have a solution, preferably in VBS I’ll take it, otherwise if it’s in C I’ll take it too but you’ll need to test by compiling to make an external command.
Thanks in advance for your help and have a good day :)
Configuration: Windows 7 / Firefox 20.0
--
Hope I helped you
Greg
12 answers
-
hello,
I’m not sure that C or VBS are the best choices for what you want to do.
How do you envision the file/folder selection interface to back up?
Is it always in the same directory where you have files/folders you want to back up? Or would you like to be able to browse your entire drive? -
Hi, thank you very much for your response. Indeed, I want to be able to browse my hard drive because files/folders can change. For the interface, something that allows selecting a list of files and folders and that lets you view the selected files with, for example, an "add" "remove" and "cancel" button. I'll post a screenshot tomorrow if I find an example that illustrates it well.
Thanks for your help (;) -
Hello,
Well, with VBS it wouldn’t be straightforward, he doesn’t know how to do that natively (with your dialog box you’ve almost pushed him to his limits already :) ).
... Maybe by calling DLLs if they have a COM interface or by building an HTML interface for him ... For C I don’t know, I’ve only ever done \"console\" applications with ...
Maybe turn to programming in VB, C++ / C# .Net. -
Hello, here is the VBS code that lets you select the save folder in VBS:
Option Explicit WScript.Echo BrowseFolder^( "My Computer", False ^) Function BrowseFolder^( myStartLocation, blnSimpleDialog ^) Const MY_COMPUTER = ^&H11^& Const WINDOW_HANDLE = 0 Dim numOptions, objFolder, objFolderItem Dim objPath, objShell, strPath, strPrompt strPrompt = "Where do you want to save the file:" If blnSimpleDialog = True Then numOptions = 0 Else numOptions = ^&H10^& End If Set objShell = CreateObject^( "Shell.Application" ^) If UCase^( myStartLocation ^) = "%userprofile%" Then Set objFolder = objShell.Namespace^( MY_COMPUTER ^) Set objFolderItem = objFolder.Self strPath = objFolderItem.Path Else strPath = myStartLocation End If Set objFolder = objShell.BrowseForFolder^( WINDOW_HANDLE, strPrompt, _ numOptions, strPath ^) If objFolder Is Nothing Then BrowseFolder = "" Exit Function End If Set objFolderItem = objFolder.Self objPath = objFolderItem.Path BrowseFolder = objPath End Function
I want to point out that this code isn’t mine, I don’t normally touch VBS.
And here is the interface I would like to obtain --> https://www.commentcamarche.net/faq/33514-vb6-vba-selectionner-une-liste-de-fichier-avec-explorateur-win
Regarding other languages you mention, I’m not really familiar with them and I’d prefer, if possible, to stay in batch.
Thanks for your help (:
PS: I also found a few VBS codes to open a dialog box to select a file to open, but that’s not exactly what I’m looking for. The previous link illustrates well what I would like. -
I coded professional solutions in VBS, installer programs, HTML interfaces, database connections, data transfer, etc...
I had a hunch about what you wanted... But in your screenshot it’s more VB than VBS. It resembles each other a bit, but VB is compiled unlike VBS...
I don’t have a ready-made solution on hand :-)
On the other hand, in other languages it’s child’s play ... -
Putting VB in is fine with me; I just need to figure out how to compile it and I could adapt it to the batch. I think the trick is that the VB called by the batch would, if possible, save the list of files and folders chosen into a txt file in, for example, the Windows temp folder so I can retrieve it with my batch.
Do you think that's possible?
--
Hoping to have helped
Greg -
Hello,
everything is still possible, or almost, but since we’re going into VB, maybe we should do it all in there... -
The problem is that I have no idea about VB at all.
--
Hoping to have helped you
Greg -
Your project is quite basic.
(Target selection, traversal of the tree, source(s) selection, Copying of file(s)/folder(s))
it could be an opportunity ... Well-made tutorials should cover all aspects of programming (in the language of your choice) that you might need, and you'll find plenty of examples on the web.
Otherwise it’s better to avoid a heavy, complicated setup.
(Otherwise, in the other direction, it seems more in line with the usual logic: Selection of source files to copy/back up, then the backup medium.) -
I’ll see what I can find, thanks for your help. (:
--
Hoping I’ve helped you
Greg -
Hi, I tested your script, it’s not bad.
I wonder if it wouldn’t be possible to adapt the VBA example to your case. I’ll look into it tomorrow if I have the courage. (I’m in the process of reinstalling a server on Linux, and it’s taking me a bit of time, but the compiles are long on a P4). -
No problem, take your time. Thanks again for your help, I’ll keep looking on my end (:
--
Hope I’ve helped
Greg