Marook-Online
* 06.Feb.2012, 14:48 UTC+1
Welcome, Guest. Please login or register.
Username:
Password:

News: Back again Wink
Main Menu
  Navigation
   Downloads
     Tools
     Music Discs
     SMF Mods
     Trainer & Patches
     EgoShare Uploader
   Guestbook
   NoPaste
   User Map
   Gallery
  
   Malware Scan
   Hacker Blacklist
   Find Abusemail
Top Downloads
Support Me !
Help me by donating a small amount!



Advanced search

Google


Pages: [1]   Go Down
0 Members and 1 Guest are viewing this topic. Topic Tools  
Read
10-Mar-2006 01:04
Marook
Administrator
*****
Offline Offline

Joined: 01-Jan-2005
Posts: 224


If you need that a user select a file, for example to open it and display its content, you could use a simple InputText() command. This is not very comfortable because the user must enter the complete path to the given file. More comfortable is to show the nice CommonDialog where the user can browse to the wanted file. Even you can set some filter that only specific filetypes would displayed. Use the followin code in your script.

Code:
Set objdlg = CreateObject("MSComDlg.CommonDialog")

objdlg.DialogTitle = "Select file to open..."
'-- With the filer option you can define, what type of file
'-- should shown in the dialog.
objdlg.Filter = "All Files (*.*)|*.*|VBScript Files (*.vbs)|*.vbs"
'-- The FilterIndex sets which filter is used by default
'-- in our example "All Files" is set as default.
objdlg.FilterIndex = 1
'-- InitDir sets the default directory to start browsing
objdlg.InitDir = "C:\"
objdlg.MaxFileSize = 260
'-- With CancelError you can select if the user pressed cancel
'-- an error-message would appear or not. True stops the execution!
objdlg.CancelError = True
'-- Shows Open Dialog
'-- You could also try ShowSave, ShowFont, ShowPrinter
objdlg.ShowOpen
  
MsgBox objdlg.FileName
Logged
 

Read
22-Nov-2006 13:03
Marook
Administrator
*****
Offline Offline

Joined: 01-Jan-2005
Posts: 224


hi,

I try to use this script but it doesn't work.
I've tried this one from Microsoft but same thing  Angry
Set objDialog = CreateObject("UserAccounts.CommonDialog")

objDialog.Filter = "All Files|*.*"
objDialog.InitialDir = "C:\"
intResult = objDialog.ShowOpen
 
If intResult = 0 Then
    Wscript.Quit
Else
    Wscript.Echo objDialog.FileName
End If


I work on 2003 R2 US (so vbs 5.6) and MDAC 2.8 is installed and with admin right (for testing). I think it must be ok ?

I always have this error
Microsoft VBScript runtime error: ActiveX component can't create object: 'MSComDlg.CommonDialog' 0x800A01AD

I must do something wrong but I don't know what... Embarrassed

If you can help me.

Best regards
« Last Edit: 04-Mar-2007 00:13 by Marook » Logged
 

Read
22-Nov-2006 16:54
Marook
Administrator
*****
Offline Offline

Joined: 01-Jan-2005
Posts: 224


Hi Keroz,

try to register the COMDLG32.OCX by entering the following command in a command prompt.

Code:
REGSVR32 C:\Windows\System32\COMDLG32.OCX

I did test this example code on different machines with no problems. The only reason that this code didnt work must be, that one or more dll's or ocx files are not registered.

Hope this helps...
« Last Edit: 22-Nov-2006 16:54 by admin » Logged
 

Pages: [1]   Go Up
Jump to:  

Theme by webtechnica.net

MHD v2.1 © 2oo8 by Marook
32116 hacking attempts defended!