Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


[Updated] File browser/ "Open" dialog in HTA

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,36250
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> [Updated] File browser/ "Open" dialog in HTA
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 [Updated] File browser/ "Open" dialog in HTA - 7/17/2006 12:58:08 AM   
  Fredledingue


Posts: 370
Score: 0
Joined: 5/9/2005
From:
Status: offline
I needed a file browser because on w98 I can't use the User object that allows using the windows "open" dialog.
Yet I can use the IE open dialog but it doesn't allow filtering by extention. So I had to sort of reinvent the wheel.

Now the real advantage of this HTA over the default dialog is that you can select files from different directories before submiting your selection.

You don't need to hold the Ctrl key to make multiple selections, but you can't use Shift+Sparrow to select groups of files.

And HTA allows you to creates your own features:

-Select all, Unselect all, Reset and other buttons
-Shows the list of the files selected
-Shows the number of files in the directory after filtering
-Separate folders from files
-Path, extention filter, detail view and sorting argument customizable from launch script

Not featuring yet:
-Address bar
-Buttons for changing  extention filter, detail view and sorting argument from the HTA file browser
-List of subfolders not sorted

Use:

Take the example from the script below.

commandline is:
WshShell.Run "filebrowser3.hta /[path] /[extentions separated by commas] /O:[sort by argument] /V:[view arguments]", 3, true

Sort argument and view argument are moreless the same as in DOS:

Sort by (/O:) :
N - by name
E - by extension 
A - by last access date
S - by size 
D - by date and time

View details (/V:) :
A -  last access date
S -  size 
D -  date and time
B -  attribute
L -  full details

Arguments can be written in whatever order you wish, with or without white space or be obmited without generating error.

When the dialog open click on file names to select them.
After the dialog is closed, the script will have to read the list from "list.tmp".


      

Here is the HTA code
Save it as "filebrowser.hta"


      

< Message edited by Fredledingue -- 11/21/2006 8:02:30 AM >


_____________________________

Fred
 
 
Revisions: 5 | Post #: 1
 
 RE: File browser/ "Open" dialog in HTA - 9/15/2006 12:03:05 PM   
  Skie

 

Posts: 58
Score: 0
Joined: 3/2/2006
Status: offline
The ability to select multiple files from multiple paths is very cool.  It doesn't work for my C: drive (C:\SubFolder works fine), but the D: drive works fine.  If I start it on the C: drive or go up a level to the C: drive I get an error Line 1 Char 1 Invalid procedure call or argument.

I also have a problem where the code bleeds into the HTML:
quote:

MyString = UCase(f.name) & VbTab & "*1*" & Replace(Replace(Replace(Replace(f.ShortName,".","")," ",""),"~",""),"-","_") & "*2*" & f.path & "')"">;;" & Replace(f.name," "," ") & ";;"

quote:

document.all.fntuserini.innerhtml = "     ntuser.ini    "

(in reply to Fredledingue)
 
 
Post #: 2
 
 RE: File browser/ "Open" dialog in HTA - 9/17/2006 11:51:40 AM   
  Fredledingue


Posts: 370
Score: 0
Joined: 5/9/2005
From:
Status: offline
Indeed, it doesn't work on C: drive when you launch it directly on C: as parameter, but I can lauch it from My Document and go up to C:, then it works normaly.
I can't launch it on D: neither. I guess that for drives we need some other code as they are not folders,while  in some case can be manipulate like a folder.

I don't know what to say about the "source bleeding" in the page.
I'll need more precision about that. What files are you attempting to list? What's your OS? IE version?  etc

_____________________________

Fred

(in reply to Skie)
 
 
Post #: 3
 
 RE: File browser/ "Open" dialog in HTA - 9/22/2006 11:19:03 AM   
  Skie

 

Posts: 58
Score: 0
Joined: 3/2/2006
Status: offline
OS: WinXP Pro
IE: 6.0

With the bleeding it doesn't matter what files I'm trying to view.  It never occurs when I launch the browser, but I'm able to recreate the bleed by doing the following.  Select at least one file, then change the folder twice by clicking on a folder or selecting "Up one level".  After thatn I get "MyString = ...." before the list of folders.  If I don't select a file I can browse through the folders as much as I want and it works fine.

An interesting quirk with this is if I select another file and then move to another folder.  The last file i selected will be in bold in front of the folders list.  If I browse to another folder (without selecting another file) after that, I get the "MyString=..." again.  If I hit reset and go to another folder, then the file name will be the last file in the file list.

The bleed for the files list issue is reproducable as well.  With it I select a file and move to a folder that has no files.  It will then read "document.all.fBOOTLOGTXT.innerhtml = "    filename.ext    " where filename.ext is the last file listed in the "Files selected:" section.  Related to this problem, if I go to a folder with no filename (and didn't select a file on the previous folder) the last file listed in the previous folder will be listed as a file in that folder.

(in reply to Fredledingue)
 
 
Post #: 4
 
 RE: File browser/ "Open" dialog in HTA - 9/25/2006 7:01:56 AM   
  Fredledingue


Posts: 370
Score: 0
Joined: 5/9/2005
From:
Status: offline
I have reproduced the error. I will try to corect it ASAIC.
Thanks for reporting it.

_____________________________

Fred

(in reply to Skie)
 
 
Post #: 5
 
 RE: File browser/ "Open" dialog in HTA - 9/25/2006 8:03:53 AM   
  Fredledingue


Posts: 370
Score: 0
Joined: 5/9/2005
From:
Status: offline
Ok, I fixed it!
New line of code in green... it wasn't that much!
The code above is corrected. Tell me if it works now...
 
Sub DoList(fPath)
t=""

_____________________________

Fred

(in reply to Fredledingue)
 
 
Post #: 6
 
 RE: File browser/ "Open" dialog in HTA - 9/27/2006 12:26:31 PM   
  Skie

 

Posts: 58
Score: 0
Joined: 3/2/2006
Status: offline
The folder one is fixed.  I can still cause the file one by selecting a file and opening a folder with no files.  document.all.fdesktopini.innerhtml = "     desktop.ini    Or if I go to a folder with no files, one file from the previous folder will display in the files list, but the number of files will be 0.

I found the fix for that issue.  You just need an ElseIf for an fCount=0.

      

Only other real issue is the C: drive thing.  Doing some msgboxing, my pagefile.sys errors out on the line Execute t.  If I do an on error resume next, it shows all the files except pagefile.sys and it duplicates the file before pagefile.sys.  Figure that might point you in the right direction for figuring out what the problem is.

(in reply to Fredledingue)
 
 
Post #: 7
 
 RE: File browser/ "Open" dialog in HTA - 9/29/2006 9:59:49 AM   
  Fredledingue


Posts: 370
Score: 0
Joined: 5/9/2005
From:
Status: offline
Hi, Skie!

I'm glad you have found and fixed a bug in my script because it's a very complicated one!
(I always wonder if toher scripters are able to decyphere my scripts)

For the C: drive issue, I think we must add some code specific for working on drives (instead of code specific to folders) but I don't know these codes yet.
I can go on C: from any subfolder without error but when I launch it with C: in the arguiment, it starts in the script directory but without error. My Pc run on w98se and it may be diferent on XP.

I won't have time to work on this next week be perhaps in two weeks... :(



_____________________________

Fred

(in reply to Skie)
 
 
Post #: 8
 
 RE: [Updated] File browser/ "Open" dialog in HTA - 11/21/2006 8:03:45 AM   
  Fredledingue


Posts: 370
Score: 0
Joined: 5/9/2005
From:
Status: offline
Added: change cursor over selectable items.
(thanks to TNO)

_____________________________

Fred

(in reply to Fredledingue)
 
 
Post #: 9
 
 RE: [Updated] File browser/ "Open" dialog in HTA - 11/26/2006 2:38:44 AM   
  TNO


Posts: 1075
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
quote:

(I always wonder if toher scripters are able to decyphere my scripts)


I won't lie, you don't make it easy to read  I've been trying to translate it onto JScript for a couple days now.

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to Fredledingue)
 
 
Post #: 10
 
 RE: [Updated] File browser/ "Open" dialog in HTA - 11/28/2006 10:53:12 PM   
  Fredledingue


Posts: 370
Score: 0
Joined: 5/9/2005
From:
Status: offline
TNO,

Here is the code in a txt file with indents! If it can help.

Why do you need to translate into JS by the way?


Attachment (1)

_____________________________

Fred

(in reply to TNO)
 
 
Post #: 11
 
 RE: [Updated] File browser/ "Open" dialog in HTA - 11/29/2006 2:14:46 AM   
  TNO


Posts: 1075
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
I actually wanted to recreate the Common.Dialog box thats available only in Win XP, and I wanted to see if I could use your implementation as a basis to start from. Since I can eat sleep and breath JS a thousand times better than vbs, I figured why not translate it while I peruse it? It be much more intuitive for me to read and alter the code in my first language, not to mention I make it a habit not to mix languages anymore.

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to Fredledingue)
 
 
Post #: 12
 
 RE: [Updated] File browser/ "Open" dialog in HTA - 11/29/2006 10:30:15 AM   
  Fredledingue


Posts: 370
Score: 0
Joined: 5/9/2005
From:
Status: offline
TNO, what do you mean exactely by "recreate the Common.Dialog box "?

Reproducing the "open" dialog box graphicaly in generated html code, could be a heavy duty operation, not as fast as my script. If that's what you mean.

For JS is a difficult language,... all these braces floating alone in the middle of the page... you know... ;)

Did the indents helped? just curious...

_____________________________

Fred

(in reply to TNO)
 
 
Post #: 13
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> [Updated] File browser/ "Open" dialog in HTA Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts