Xandy Posted June 12, 2013 Share Posted June 12, 2013 Is there a way to set focus in a fileopendialog()? I would like to set the initial focus to the file selection where up, down, left, right arrows, select different files. I tried scanning the init dir first and selecting the first file as the first file suggested by fileopendialog(). Although it did change the file suggestion it did not affect control focus within the dialog. I allow users to select options via keyboard, a option brings up a fileopendialog(). It would be nice not to force the user to grab his or her mouse. Video Example: http://www.youtube.com/watch?v=0PA29bwDeGU&feature=youtu.be Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
TheSaint Posted June 12, 2013 Share Posted June 12, 2013 I presume you've tried the Window Info Tool, and used Window Title, Class, etc? And Tabs etc if need be? Xandy 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Xandy Posted June 12, 2013 Author Share Posted June 12, 2013 (edited) I have not, but I see where you are going. That might be the way I'll have to do it. Thank you! Edited June 12, 2013 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Xandy Posted June 13, 2013 Author Share Posted June 13, 2013 I was thinking you meant ControlClick() or setting focus prier. The problem I'm having with that logic is the dialog would have to exist. The program is held at the call to fileopendialog() and the controls don't exist until I call fileopendialog(). The Windows Info Tool showed distinguishable results for the file list section. Class: DirectUIHWND Classname: DirectUIHWND2 Advanced Mode: [CLASS:DirectUIHWND; INSTANCE:2] but I don't know how to use them before the controls exist. Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
DW1 Posted June 13, 2013 Share Posted June 13, 2013 If you are trying to avoid writing your own fileopendialog, then you could write a temp file to do the work for you. $sTitle = 'This is my file open title' $sTempau3 = "WinWaitActive('" & $sTitle & "', '', 10)" & @CRLF $sTempau3 &= "ControlFocus('" & $sTitle & "', '', '[CLASS:DirectUIHWND; INSTANCE:2]')" $hFile = FileOpen(@TempDir & '\tempau3.au3', 2) FileWrite($hFile, $sTempau3) FileClose($hFile) Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @TempDir & '\tempau3.au3"') FileOpenDialog($sTitle,'','') Xandy 1 AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Solution DW1 Posted June 13, 2013 Solution Share Posted June 13, 2013 Better yet, don't use a temp file at all by getting the winwait and controlfocus in the same singe line. $sTitle = 'This is my file open title' $sTempau3 = "If WinWaitActive('" & $sTitle & "', '', 10) And ControlFocus('" & $sTitle & "', '', '[CLASS:DirectUIHWND; INSTANCE:2]') Then ConsoleWrite('')" Run(@AutoItExe & ' /AutoIt3ExecuteLine "' & $sTempau3 & '"') FileOpenDialog($sTitle,'','') Xandy 1 AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Xandy Posted June 13, 2013 Author Share Posted June 13, 2013 Thank you. I'll see what I can do with that in a couple hours after some house work. Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Xandy Posted June 13, 2013 Author Share Posted June 13, 2013 (edited) It took me a little while because I just to had to learn how it worked by doing it wrong. Your example works as is. Building my own browse file dialog is the other solution. I have one I built for browsing images, but sometimes it glitches when traversing a new dirpath and I'd want to reorganize the button layout. Not what I want to be doing right now. Your solution rocks! Do you know of any reading material on AutoIt3ExecuteLine use and formatting? I noticed FileOpenDialog() wouldn't run from there, I don't think beep() worked either. Either way, Thanks danwilli. Edited June 13, 2013 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
DW1 Posted June 13, 2013 Share Posted June 13, 2013 (edited) The only documentation for it that I know of is in the Using AutoIt > Running Scripts part of the help file. It doesn't go in to very much detail. It's at the bottom of the page under "AutoIt specific command Line Switches". Both Beep() and FileOpenDialog() worked fine for me using AutoIt3ExecuteLine. Strange that it didn't for you. $sTempau3 = 'FileOpenDialog(''' & $sTitle & ''', '''', '''')' Run(@AutoItExe & ' /AutoIt3ExecuteLine "' & $sTempau3 & '"') $sTempau3 = 'Beep()' Run(@AutoItExe & ' /AutoIt3ExecuteLine "' & $sTempau3 & '"') Edited June 13, 2013 by danwilli Xandy 1 AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Xandy Posted June 13, 2013 Author Share Posted June 13, 2013 (edited) I'm to new to the ability. I'm sure I messed something up with the commands when splicing it with my code. I'll learn thank you for the support and feed back. Edited June 13, 2013 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
KaFu Posted June 13, 2013 Share Posted June 13, 2013 Maybe you give the WinApiEX function with the fabulous name _WinAPI_ShellOpenFolderAndSelectItems() a try too? Xandy 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
DW1 Posted June 13, 2013 Share Posted June 13, 2013 Maybe you give the WinApiEX function with the fabulous name _WinAPI_ShellOpenFolderAndSelectItems() a try too? What an aptly named function that I've never noticed before. Good call AutoIt3 Online Help Link to comment Share on other sites More sharing options...
TheSaint Posted June 13, 2013 Share Posted June 13, 2013 It took me a little while because I just to had to learn how it worked by doing it wrong. An abject lesson to many others here, that is the continual pathway for most of us, as it can't be helped ... if you actually want to learn. Xandy 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) 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