AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FileSelectFile

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
beardboy



Joined: 02 Mar 2004
Posts: 444
Location: SLC, Utah

PostPosted: Fri Mar 19, 2004 5:00 am    Post subject: FileSelectFile Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Mar 19, 2004 5:37 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
beardboy



Joined: 02 Mar 2004
Posts: 444
Location: SLC, Utah

PostPosted: Fri Mar 19, 2004 5:41 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Mar 19, 2004 5:48 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Mar 26, 2004 1:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group