BlueScreen Posted December 16, 2003 Share Posted December 16, 2003 Hey, again... Is there a way to make the FileOpenDialog window to pop in the center of the screen? 10x Link to comment Share on other sites More sharing options...
scriptkitty Posted December 17, 2003 Share Posted December 17, 2003 (edited) Well if you want the exact center, and you feel like being creative This asumes you run it on a machine AutoIt is already installed on. I thought twice about posting this code, because it leads in a line I didn't want to point. But it can be used for many cool little things. ...Edit Make a small program to change position of the window. You can call it like a function with run("move to center.au3"). Get creative, and you can use the get window size, and $CmdLine[x] and use it to center any window. ... $size = WinGetClientSize("Program Manager") ; this gets client size ; Choose a file window is the example name. ; Note my box size is 563,419 on WinXP $x=($size[0]-563)/2 $y=($size[1]-419)/2 winwaitactive("Choose a file") WinMove ( "Choose a file", "", $x, $y) Edit: Note, I changed my mind and revised the code. My old code may have helped the wrong type of folks use this for evil purposes. It was a bit of cute code, but since I got my disable icon back, I am not going to post anything remotely helping virus folks. Oh yea, "Choose a file." for the window name is called out in example from the help file, so I used that for it: $var = FileOpenDialog( "Choose a file.", "c:\program files", "My Files (*.au3)", 1 + 4 ) think of this little program as a funtion and use: ; centerme.au3 before compile ; Use of this file is centerme.exe nameofwindow AutoItSetOption("WinWaitDelay", 0);Time in millseconds to pause (default=250). if $CmdLine[0]=1 then winwaitactive($CmdLine[1]) $Namesize=WinGetClientSize($CmdLine[1]) $size = WinGetClientSize("Program Manager") ; this gets client size $x=($size[0]-$namesize[0])/2 $y=($size[1]-$namesize[1])/2 winwaitactive($CmdLine[1]) WinMove ( $CmdLine[1], "", $x, $y) else msgbox(1,"Error","Please call out Window Name") endif Edited December 17, 2003 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
scriptkitty Posted December 17, 2003 Share Posted December 17, 2003 oops, I guess I should post the simple code to call it: After you compile centerme.au3 of course... run("centerme.exe Choose") $var = FileOpenDialog( "Choose a file.", "c:\program files", "My Files (*.au3)", 1 + 4 ) AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
BlueScreen Posted December 18, 2003 Author Share Posted December 18, 2003 Thanks, Scriptkitty! I don't need the exact center, yet I don't want the window to be displayed in the top left corner. Your solution is good (and working), but little complex. I thought there is a more simple solution positioning the File open dialog window (Not necessary in the middle...) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now