 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Fri Mar 19, 2004 5:00 am Post subject: FileSelectFile |
|
|
To have the Dialog box appear in the center of the screen like MsgBox, but have the option to position the window like you added for InputBox.
thanks,
beardboy |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Fri Mar 19, 2004 5:37 am Post subject: |
|
|
If all goes well, there will be at least one way to accomplish this in the next release:
GosubTimer, MoveDialog, 10 ; Autorun this subroutine every 10ms
FileSelectFile, SelectedFile
MsgBox, The user selected %SelectedFile%.
return
MoveDialog:
; System sometimes takes a while to display it, so keep trying:
IfWinNotExist, Select File - %A_SCRIPTNAME%, , return
; Otherwise:
GosubTimer, MoveDialog, Off ; Disable the timer.
WinMove, 0, 0 ; Move the "last found window" to upper-left.
return
Though admittedly adding some new position parameters to FileSelectFile (and perhaps MsgBox and FileSelectFolder) would make this easier to script. However, there's a trade-off since new parameters make the commands appear more complicated and cluttered in the documentation, so I'm on the fence (given how rarely these params would be used). |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Fri Mar 19, 2004 5:41 am Post subject: |
|
|
I always forget of other features that could make what I wanted possible. I can just WinMove the window to the place I want it.
thanks,
beardboy |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Fri Mar 19, 2004 5:48 am Post subject: |
|
|
That's a tempting thing to try, but it won't work unless you assign a hotkey to do the "moving" step separately. This is because the script's thread is stuck in the FileSelectFile command until the user makes a selection.
This same concept is what makes coding the move in C++ non-trivial. Fortunately, I think the framework is already there in this case. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Fri Mar 26, 2004 1:42 pm Post subject: |
|
|
If you haven't already found a way to do this, I think a timer can get it done like this:
| Code: | SetTimer, MoveDialog, 50 ; Must set the timer first.
FileSelectFile, OutputVar, 0, , Select a text file:
return
MoveDialog:
IfWinNotExist, Select a text file:, , return ; Leave the timer enabled.
; Otherwise, turn off the timer and operate on the window found by the above:
SetTimer, MoveDialog, off
WinMove, 0, 0
WinActivate
return
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|