Jump to content

Custom File Dialog Using Obj


GaryFrost
 Share

Recommended Posts

!!!! Warning..............!!!! This will work only if you have MS Devtools installed

OR

!!!! At your own risk !!!! follow the link in post 11

Was just playing around with what Lapo shared in support (Originally from Svenp).

I'm sure if someone wants to this could be expanded a bit more. :)

Decided to share for all those that are always saying I ran the filedialog and no file opened.

1st function reads file into edit control also shows how to save the text from edit control back to a file

2nd function reads file into a variable

3rd function reads file into a array

all the above are done thru flags passed to the _FileDialog function

Also showed how to use old style file dialog in 3rd function

Enjoy!!!

Gary

http://www.autoitscript.com/fileman/users/gafrost/projects/TestFileDialog.au3

http://www.autoitscript.com/fileman/users/gafrost/projects/FileDialog.au3

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

wow A+ man. good job.

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Hi,

Why can I never get objects and others can!!!!!

$OpenDialog = ObjCreate("MSComDlg.CommonDialog")

Gives me no object.

I had this problem with RichTextEdit too...

Do i need to set a permission or something?

Best, randall

Link to comment
Share on other sites

Hi,

Why can I never get objects and others can!!!!!

Gives me no object.

I had this problem with RichTextEdit too...

Do i need to set a permission or something?

Best, randall

What OS are you using?

I'm using WinXP Pro SP2

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Hi,

Yes, Same; with all updates as well

tried on 2 separate computerss..

Randall

No clue, I ran this at work with no problems, and the security templates are a lot tighter at work.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Hi,

Yes, Same; with all updates as well

tried on 2 separate computerss..

Randall

Your not alone it seems. I also have XP Pro SP2 and it fails also :) .

>"C:\Program Files\Autoit3\SciTe\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "D:\Scripts\AutoIt Scripts\Forum UDFs\TestFileDialog.au3" /autoit3dir "C:\Program Files\Autoit3\SciTe\..\Beta" /UserParams  
>Running AU3Check (1.54.1.1)  params:  from:C:\Program Files\Autoit3\SciTe\..\Beta
+>AU3Check ended.rc:0
>Running:(3.1.1.115):C:\Program Files\Autoit3\SciTe\..\Beta\autoit3.exe "D:\Scripts\AutoIt Scripts\Forum UDFs\TestFileDialog.au3"   
D:\Scripts\AutoIt Scripts\Forum UDFs\FileDialog.au3 (128) : ==> Illegal text at the end of statement (one statement per line).: 
With $OpenDialog 
Only Object-type variables allowed in a WITH statement!

+>AutoIT3.exe ended.rc:0
>Exit code: 0   Time: 2.738
Link to comment
Share on other sites

Your not alone it seems. I also have XP Pro SP2 and it fails also :) .

>"C:\Program Files\Autoit3\SciTe\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "D:\Scripts\AutoIt Scripts\Forum UDFs\TestFileDialog.au3" /autoit3dir "C:\Program Files\Autoit3\SciTe\..\Beta" /UserParams  
>Running AU3Check (1.54.1.1)  params:  from:C:\Program Files\Autoit3\SciTe\..\Beta
+>AU3Check ended.rc:0
>Running:(3.1.1.115):C:\Program Files\Autoit3\SciTe\..\Beta\autoit3.exe "D:\Scripts\AutoIt Scripts\Forum UDFs\TestFileDialog.au3"   
D:\Scripts\AutoIt Scripts\Forum UDFs\FileDialog.au3 (128) : ==> Illegal text at the end of statement (one statement per line).: 
With $OpenDialog 
Only Object-type variables allowed in a WITH statement!

+>AutoIT3.exe ended.rc:0
>Exit code: 0   Time: 2.738
Curious, do you have the same problem with the example for the richedit control in the beta help?

It's in the GUICtrlCreateEdit example.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Curious, do you have the same problem with the example for the richedit control in the beta help?

It's in the GUICtrlCreateEdit example.

The Gui shows with the edit control containing standard text, but when closed, it shows Com error msgboxes as below

---------------------------
AutoItCOM Test
---------------------------
We intercepted a COM Error !



err.description is:     0

err.windescription: Class is not licensed for use



err.number is:  80040112

err.lastdllerror is:    0

err.scriptline is:  32

err.source is:  0

err.helpfile is:    0

err.helpcontext is:     0
---------------------------
OK   
---------------------------

---------------------------
AutoItCOM Test
---------------------------
We intercepted a COM Error !



err.description is:     0

err.windescription: The operation completed successfully.



err.number is:  FFFFFFFF

err.lastdllerror is:    0

err.scriptline is:  43

err.source is:  0

err.helpfile is:    0

err.helpcontext is:     0
---------------------------
OK   
---------------------------

Similar problem showing in Scite's output pane

>"C:\Program Files\Autoit3\SciTe\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "C:\test.au3" /autoit3dir "C:\Program Files\Autoit3\SciTe\..\Beta" /UserParams  
>Running AU3Check (1.54.1.1)  params:  from:C:\Program Files\Autoit3\SciTe\..\Beta
+>AU3Check ended.rc:0
>Running:(3.1.1.115):C:\Program Files\Autoit3\SciTe\..\Beta\autoit3.exe "C:\test.au3"   
C:\test.au3 (46) : ==> Illegal text at the end of statement (one statement per line).: 
With $oRP 
Only Object-type variables allowed in a WITH statement!

+>AutoIT3.exe ended.rc:0
>Exit code: 0   Time: 8.210
Link to comment
Share on other sites

The Gui shows with the edit control containing standard text, but when closed, it shows Com error msgboxes as below

---------------------------
AutoItCOM Test
---------------------------
We intercepted a COM Error !
err.description is:     0

err.windescription: Class is not licensed for use
err.number is:  80040112

err.lastdllerror is:    0

err.scriptline is:  32

err.source is:  0

err.helpfile is:    0

err.helpcontext is:     0
---------------------------
OK   
---------------------------

---------------------------
AutoItCOM Test
---------------------------
We intercepted a COM Error !
err.description is:     0

err.windescription: The operation completed successfully.
err.number is:  FFFFFFFF

err.lastdllerror is:    0

err.scriptline is:  43

err.source is:  0

err.helpfile is:    0

err.helpcontext is:     0
---------------------------
OK   
---------------------------

Similar problem showing in Scite's output pane

>"C:\Program Files\Autoit3\SciTe\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "C:\test.au3" /autoit3dir "C:\Program Files\Autoit3\SciTe\..\Beta" /UserParams  
>Running AU3Check (1.54.1.1)  params:  from:C:\Program Files\Autoit3\SciTe\..\Beta
+>AU3Check ended.rc:0
>Running:(3.1.1.115):C:\Program Files\Autoit3\SciTe\..\Beta\autoit3.exe "C:\test.au3"   
C:\test.au3 (46) : ==> Illegal text at the end of statement (one statement per line).: 
With $oRP 
Only Object-type variables allowed in a WITH statement!

+>AutoIT3.exe ended.rc:0
>Exit code: 0   Time: 8.210
Ok, after some searching, it appears this is a problem if you don't have any ms dev tools installed, being a programmer, i have dev tools installed, there is a work around, be it at your own risk.

http://www.codecomments.com/IE_Scripting/message315992.html

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I asked about a multiple fileopendialogue all lastweek,

and altho with flags it can be created the pending result does not give

whats actually been selected only the folder

ie: with $cdlOFNAllowMultiselect, it doesnt work in the example given

shame that, still i guess autoit cant do everthing.

Edited by Rick

Who needs puzzles when we have AutoIt!!

Link to comment
Share on other sites

I asked about a multiple fileopendialogue all lastweek,

and altho with flags it can be created the pending result does not give

whats actually been selected only the folder

ie: with $cdlOFNAllowMultiselect, it doesnt work in the example given

shame that, still i guess autoit cant do everthing.

Has nothing to do with autoit.

#include <Array.au3>
#include "FileDialog.au3"
Opt("MustDeclareVars", 1)

_Main_Multiple_Select()

Func _Main_Multiple_Select()
    Local $file, $a_file
    Local $Caption = "Choose the file you want to open...", $Default_File = ""
    Local $Filter = "AutoIt (*.au3;*.aut)|*.au3;*.au3|Text (*.txt)|*.txt|ALL (*.*)|*.*"
    Local $Default_Index = 1, $Dialog = 0
    Local $Flags = BitOR($cdlOFNFileMustExist, $cdlOFNPathMustExist, $cdlOFNNoChangeDir, $cdlOFNAllowMultiselect, $cdlOFNLongNames); old style dialog
    $file = _FileDialog ($a_file, $Caption, @ScriptDir, $Default_File, $Filter, $Default_Index, $Flags, $Dialog)
    If @error Then
        _DialogError()
    Else
        $file = StringSplit($file," ")
        _ArrayDisplay($file, "Multiple File Select")
    EndIf
EndFunc ;==>_Main_Into_Array

Func _DialogError()
    MsgBox(0, "File Dialog", "Intercepted an Error !" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $DialogError.description & @CRLF & _
            "err.number is: " & @TAB & Hex($DialogError.number, 8) & @CRLF & _
            "err.scriptline is: " & @TAB & $DialogError.scriptline & @CRLF)
EndFunc ;==>_DialogError
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

i was referring to the example with the proper filedialogue screen, not the smaller one showing shortfoldernames

That can probably be done also, just haven't figured it out yet, the one that works is space delimited, the other is null delimited.

Didn't know one was improper.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • 5 months later...

Version 3.2.0.1

I didn't compile (convert to executable) it though. But all the other examples test just fine by opening the au3 file from autoit3.exe.

I've re-tried it on two different systems, no compiling, both ran fine.

Both are WinXP Pro SP2 tho.

I'll test on W2K and W98 and see what happens.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Ok, tried on 2k box that I don't have MS Dev Tools installed, got the same problem.

Follow the link on post #11

I tried it and the script worked on 2k

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...