Jump to content
Sign in to follow this  
Achilles

FileOpenDialog()

Recommended Posts

Achilles

Much like this... However this is not an open code function so I don't really know how I would change it... I want the FileOpenDialog to not automatically go to the top left part of the screen, I would prefer it pop up in the middle or at least inside the window that I'm calling it from.

Apparently gafrost knows knows a lot about this considering he found the solution to my previous problem... Maybe this, if someone makes it work, could be put in the Autoit code like gafrost suggested:

Submitted proposed change to _ChooseColor and _ChooseFont to add that param.

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
/dev/null

$message = "Hold down Ctrl or Shift to choose multiple files."

$filename = _MoveFileOpenDialog($message,300,300)

$var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var)
EndIf

FileDelete($filename)



func _MoveFileOpenDialog($title,$posx,$posy)
    Local $temp = EnvGet("temp")
    Local $filename = $temp & "\move_file_open_dialog.au3"
    
    Local $script = 'WinWaitActive("' & $title & '")' & @CRLF
    $script &= 'WinMove("' & $title & '","",' & $posx & ',' & $posy & ')'
    FileWrite($filename,$script)
    MsgBox(0,"",$script & @CRLF & $filename)
    Run(@AutoItExe & " /AutoIt3ExecuteScript " & $filename)
    Return $filename
EndFunc


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites
Achilles

$message = "Hold down Ctrl or Shift to choose multiple files."

$filename = _MoveFileOpenDialog($message,300,300)

$var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var)
EndIf

FileDelete($filename)
func _MoveFileOpenDialog($title,$posx,$posy)
    Local $temp = EnvGet("temp")
    Local $filename = $temp & "\move_file_open_dialog.au3"
    
    Local $script = 'WinWaitActive("' & $title & '")' & @CRLF
    $script &= 'WinMove("' & $title & '","",' & $posx & ',' & $posy & ')'
    FileWrite($filename,$script)
    MsgBox(0,"",$script & @CRLF & $filename)
    Run(@AutoItExe & " /AutoIt3ExecuteScript " & $filename)
    Return $filename
EndFunc
I've seen something similar to this, but the flicker of it in the top top left corner makes it useless. The reason I want the window to start in the middle is to be user friendly, but the flicker outweighs the advantage of having the window positioned in the middle.

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
/dev/null

I've seen something similar to this, but the flicker of it in the top top left corner makes it useless. The reason I want the window to start in the middle is to be user friendly, but the flicker outweighs the advantage of having the window positioned in the middle.

well, then try this. No flicker, at least on a fast machine.

$message = "Hold down Ctrl or Shift to choose multiple files."

$filename = _MoveFileOpenDialog($message,300,300)

$var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var)
EndIf

FileDelete($filename)
func _MoveFileOpenDialog($title,$posx,$posy)
    Local $temp = EnvGet("temp")
    Local $filename = $temp & "\move_file_open_dialog.au3"
   
    Local $script = 'Global $title = "' & $title & '"' & @CRLF
    $script &= 'Global $pos_x = ' & $posx & @CRLF
    $script &= 'Global $pos_y = ' & $posy & @CRLF
    $script &= 'AdlibEnable("_Move",10)' & @CRLF
    $script &= 'while 1' & @CRLF
    $script &= '    sleep(1000)' & @CRLF
    $script &= 'wend' & @CRLF
    $script &= 'Func _Move()' & @CRLF
    $script &= '   if (WinActive($title)) Then' & @CRLF
    $script &= '      WinMove($title,"",$pos_x,$pos_y)' & @CRLF
    $script &= '      Exit' & @CRLF
    $script &= '   EndIf' & @CRLF
    $script &= 'EndFunc' & @CRLF

    FileWrite($filename,$script)
    ;MsgBox(0,"",$script & @CRLF & $filename)
    Run(@AutoItExe & " /AutoIt3ExecuteScript " & $filename)
    sleep(250)
    Return $filename
EndFunc

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites
Achilles

well, then try this. No flicker, at least on a fast machine.

c2--><!--YzItLSYjNjI7JiM2MDsmIzMzOy0tQ2lZak1ETTJPMjFsYzNOaFoyVWdQU0FtY1hWdmREdEliMnhrSUdSdmQyNGdRM1J5YkNCdmNp
QlRhR2xtZENCMGJ5QmphRzl2YzJVZ2JYVnNkR2x3YkdVZ1ptbHNaWE11Sm5GMQpiM1E3Q2dvbUl6QXpOanRtYVd4bGJtRnRaU0E5
SUY5TmIzWmxSbWxzWlU5d1pXNUVhV0ZzYjJjb0ppTXdNelk3YldWemMyRm5aU3d6TURBc016QXdLUW9LSmlNd016WTdkbUZ5CklE
MGdSbWxzWlU5d1pXNUVhV0ZzYjJjb0ppTXdNelk3YldWemMyRm5aU3dnUUZkcGJtUnZkM05FYVhJZ0ptRnRjRHNnSm5GMWIzUTdK
aU13T1RJN0puRjFiM1E3TENBbWNYVnYKZER0SmJXRm5aWE1nS0NvdWFuQm5PeW91WW0xd0tTWnhkVzkwT3l3Z01TQXJJRFFnS1Fv
S1NXWWdRR1Z5Y205eUlGUm9aVzRLSUNBZ0lFMXpaMEp2ZUNnME1EazJMQ1p4ZFc5MApPeVp4ZFc5ME95d21jWFZ2ZER0T2J5Qkdh
V3hsS0hNcElHTm9iM05sYmlaeGRXOTBPeWtLUld4elpRb2dJQ0FnSmlNd016WTdkbUZ5SUQwZ1UzUnlhVzVuVW1Wd2JHRmpaU2dt
Ckl6QXpOanQyWVhJc0lDWnhkVzkwTzN3bWNYVnZkRHNzSUVCRFVreEdLUW9nSUNBZ1RYTm5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WcKSUNBbUl6QXpOanR6WTNKcGNIUWdKbUZ0Y0RzOUlDWWpN
ems3Ulc1a1JuVnVZeVlqTXprN0lDWmhiWEE3SUVCRFVreEdDZ29KUm1sc1pWZHlhWFJsS0NZak1ETTJPMlpwYkdWdQpZVzFsTENZ
ak1ETTJPM05qY21sd2RDa0tJQ0FnSUR0TmMyZENiM2dvTUN3bWNYVnZkRHNtY1hWdmREc3NKaU13TXpZN2MyTnlhWEIwSUNaaGJY
QTdJRUJEVWt4R0lDWmhiWEE3CklDWWpNRE0yTzJacGJHVnVZVzFsS1FvZ0lDQWdVblZ1S0VCQmRYUnZTWFJGZUdVZ0ptRnRjRHNn
Sm5GMWIzUTdJQzlCZFhSdlNYUXpSWGhsWTNWMFpWTmpjbWx3ZENBbWNYVnYKZERzZ0ptRnRjRHNnSmlNd016WTdabWxzWlc1aGJX
VXBDZ2x6YkdWbGNDZ3lOVEFwQ2lBZ0lDQlNaWFIxY200Z0ppTXdNelk3Wm1sc1pXNWhiV1VLUlc1a1JuVnVZd289LS0mIzYyOyYj
NjA7JiMzMzstLWVn--><!--eg

Cheers

Kurt

Sweet, that works great, thanks!

EDIT: ??? What happened to the autoit code??? :rolleyes:

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
gsb

The end user will need to have autoIt3 installed for this to work, no?

gsb


"Did you ever stop to think? ...and forget to restart!"

Share this post


Link to post
Share on other sites
Achilles

The end user will need to have autoIt3 installed for this to work, no?

gsb

Yes, but I plan on compiling it and just running it...

EDIT: Never mind, see posts below!

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
Valuater

The end user will need to have autoIt3 installed for this to work, no?

gsb

Actually...no, if it is compiled

@AutoItExe

The full path and filename of the AutoIt executable currently running. For compiled scripts it is the path of the compiled script

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
herewasplato

Also from the help file under:

Running Scripts

Form3: Compiled.exe [/ErrorStdOut] [/AutoIt3ExecuteScript file] [params ...]

Execute another script file from a compiled AutoIt3 Script File. Then you don't need to fileinstall another copy of AutoIT3.exe in your compiled file.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
gsb

This "Execute another script file from a compiled AutoIt3 Script File. Then you don't need to fileinstall another copy of AutoIT3.exe in your compiled file." I missed.

I was looking at this statement: Run(@AutoItExe & " /AutoIt3ExecuteScript " & $filename)

TYVM :rolleyes:

gsb

Edited by gsb

"Did you ever stop to think? ...and forget to restart!"

Share this post


Link to post
Share on other sites
GaryFrost

Much like this... However this is not an open code function so I don't really know how I would change it... I want the FileOpenDialog to not automatically go to the top left part of the screen, I would prefer it pop up in the middle or at least inside the window that I'm calling it from.

Apparently gafrost knows knows a lot about this considering he found the solution to my previous problem... Maybe this, if someone makes it work, could be put in the Autoit code like gafrost suggested:

If someone has the time and notion, could do like I did with the others, this has an hwnd owner field

GetOpenFileName


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites
Champak

I'm trying to also get the dialog to change size, but it will only work the first time. The second time I try to access the dialog, it wont allow me to click anything, if you look at the cursor in the file name input, it is steady and not blinking.

This is what I have:

Func _MoveFileOpenDialog($title,$posx,$posy,$dimw,$dimh)
    
    Local $temp = EnvGet("temp")
    Local $iPathSet = $temp & "\move_file_open_dialog.au3"
   
    Local $script = 'Global $title = "' & $title & '"' & @CRLF
    $script &= 'Global $pos_x = ' & $posx & @CRLF
    $script &= 'Global $pos_y = ' & $posy & @CRLF
    $script &= 'Global $dim_w = ' & $dimw & @CRLF
    $script &= 'Global $dim_h = ' & $dimh & @CRLF
    $script &= 'AdlibEnable("_Move",10)' & @CRLF
    $script &= 'while 1' & @CRLF
    $script &= '    sleep(1000)' & @CRLF
    $script &= 'wend' & @CRLF
    $script &= 'Func _Move()' & @CRLF
    $script &= '   if (WinActive($title)) Then' & @CRLF
    $script &= '      WinMove($title,"",$pos_x,$pos_y,$dim_w,$dim_h)' & @CRLF
    $script &= '      Exit' & @CRLF
    $script &= '   EndIf' & @CRLF
    $script &= 'EndFunc' & @CRLF

    FileWrite($iPathSet,$script)
    Run(@AutoItExe & " /AutoIt3ExecuteScript " & $iPathSet)
    Sleep(250)
    Return $iPathSet

EndFunc

Share this post


Link to post
Share on other sites
Champak

Thanks, I keep forgetting to uncheck "Search this forum only?".

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.