topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 3:57 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: set focus in "file name" control?  (Read 11561 times)

rshory

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
set focus in "file name" control?
« on: August 26, 2012, 12:52 AM »
Is there a dialog extender that will set focus to the "file name" control, so I can just start typing the file name without clicking there first? I have tried several and none of them do this. I have software for my scanner (HP PrecisionScan Pro) which worked fine under Windows XP. However, under Windows 7, the File Save dialog comes up with the focus set evidently nowhere. I have to either explicitly click in the "File Name" control, or press <Tab> four times first, before I can start typing the file name. This seems trivial, but it more than doubles the effort of saving a file.
The dialog extenders I've tried do all sorts of cool things, but none of them have this simple option. Does anyone know another way to make this happen, besides a dialog extender? Or how I would write my own dialog extender?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: set focus in "file name" control?
« Reply #1 on: August 26, 2012, 09:03 AM »
Hi, rshory, and welcome to the DonationCoder site.  The extender that I use, FlashFolder, works like you describe (for me anyway =]).

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: set focus in "file name" control?
« Reply #2 on: August 26, 2012, 03:05 PM »
Have you tried Listary?

rshory

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: set focus in "file name" control?
« Reply #3 on: September 03, 2012, 10:19 AM »
Neither "FlashFolder" nor "Listary" did what I wanted.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: set focus in "file name" control?
« Reply #4 on: September 03, 2012, 02:27 PM »
I have tried several and none of them do this. I have software for my scanner (HP PrecisionScan Pro) which worked fine under Windows XP. However, under Windows 7, the File Save dialog comes up with the focus set evidently nowhere.

have you tried running the problem software in XP compatibility mode?
Tom

rshory

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: set focus in "file name" control?
« Reply #5 on: September 07, 2012, 08:52 AM »
I tried every compatibility mode back to Windows 95. No difference.

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: set focus in "file name" control?
« Reply #6 on: September 07, 2012, 03:49 PM »
Is it possible to write a macro in AHK, AutoIt, PowerPro or something, that will watch for the appropriate window, and put the cursor in the right location whenever it first appears?

rshory

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: set focus in "file name" control?
« Reply #7 on: September 11, 2012, 10:40 PM »
 Well, like everything in computers "it's easy -- after you know how".

 Of the three scripting suggestions, I chose AutoIt at random. It took me about a day to learn enough to write the few lines of code I needed. Here it is, with all my debugging comments still in. I just start it in the background, and then kill the process after I'm done scanning; or leave it running till next time.

Code: Text [Select]
  1. While 1
  2.         $handle = WinWaitActive("Save As", "File &name:") ; listen for Save As dialog
  3. ;       MsgBox(0, "Event", "Save As window active")
  4.         If (WinExists("HP Precisionscan Pro") = 1) Then ; is the parent app running?
  5.         ; assure the app is indeed the parent of this Save As dialog
  6.                 $HPPsPHandle = WinGetHandle("HP Precisionscan Pro")
  7. ;               msgbox(0,"PS handle", $HPPsPHandle)
  8.                 $result = DllCall("user32.dll", "int", "GetParent", "hwnd", $handle)
  9. ;               msgbox(0,"Result0",$result[0])
  10. ;               msgbox(0,"Result1",$result[1])
  11.         ; parent handle is in hex, and result in decimal, but equality works
  12.                 If ($result[0] = $HPPsPHandle) Then
  13. ;                       msgbox (0,"OK", "They match")
  14.                         Send("!n") ; send Alt-n to set focus to File Name control
  15.                 EndIf
  16.         EndIf
  17.         ; wiat till the dialog closes, so as not to re-fire
  18.         WinWaitClose($handle)
  19. WEnd