AutoHotkey Community

It is currently May 27th, 2012, 10:04 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: FileSelectFile
PostPosted: March 19th, 2004, 5:00 am 
Offline

Joined: March 2nd, 2004, 10:10 pm
Posts: 443
Location: SLC, Utah
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2004, 5:37 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2004, 5:41 am 
Offline

Joined: March 2nd, 2004, 10:10 pm
Posts: 443
Location: SLC, Utah
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2004, 5:48 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2004, 1:42 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group