Sign in to follow this  
Followers 0
Mechaflash

Issue with combobox in an app

6 posts in this topic

#1 ·  Posted (edited)

Automating searches in Foxit Reader, and there's a dropdown that lets you select common folders to search in, and one of the options is "<Browse...>". I use ControlCommand() to select browse and a window "Browse For Folder" appears. This is what's interesting... my script pauses...

I put in a consolewrite() after the ControlCommand() and it nvr prints to the console. I even put an AdLibRegister() function prior to the ControlCommand() and THAT never runs either. The script DOES continue AFTER I close the "Browse For Folder" window... WTH!?

Func _FoxitWindow()
    Opt("WinTitleMatchMode", 2) ; Perform a string-in-string type search for window titles.
    Opt("CaretCoordMode", 0) ; Define window coordinates relative to the defined window
    AdlibRegister("_Browse")
    ControlCommand("Foxit Reader", "", "[CLASS:ComboBox; INSTANCE:1]", "SelectString", "<Browse...>")
    ;At this point the Browse For Window appears
    consolewrite("test 1" & @CRLF) ; never populates
EndFunc

Func _Browse()
    ConsoleWrite("BROWSE" & @CRLF) ; never populates
    If WinExists("Browse For Folder") Then
        AdlibUnRegister("_Browse")
        ControlSetText("Browse For Folder", "", "[CLASS:Edit; INSTANCE:1]", "\\test\folder", 1)
    EndIf
EndFunc
Edited by Mechaflash

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

The new window deadlocks your script. send the 'controlcommand' from another process...helpfile = 'command line parameters'...option 4, i believe.

This will probably work:

Run(@AutoItExe & " /AutoIt3ExecuteLine " & 'ControlCommand("Foxit Reader", "", "[CLASS:ComboBox; INSTANCE:1]", "SelectString", "<Browse...>")')

allows the new process to be deadlocked instead.

edit: oops, need to have the command wrapped:

Run(@AutoItExe & " /AutoIt3ExecuteLine  ""ControlCommand('Foxit Reader', '', '[CLASS:ComboBox; INSTANCE:1]', 'SelectString', '<Browse...>')""")
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

for some reason it doesn't execute...

EDIT:

Had to change the title for the window in ControlCommand() to the entire title length, as I had

Opt("WinTitleMatchMode", 2) ; stringinstr type search in titles

in my full script

EDIT2:

Meh... after compiling to an .exe it doesn't run the command

Edited by Mechaflash

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

What would cause this to run not compiled but it won't run compiled?

Func _FoxitWindow()
    Opt("WinTitleMatchMode", 2) ; Perform a string-in-string type search for window titles.
    Opt("CaretCoordMode", 0) ; Define window coordinates relative to the defined window
    $command = "ControlCommand('Start - Foxit Reader', '', '[CLASS:ComboBox; INSTANCE:1]', 'SelectString', '<Browse...>')"
    WinActivate("Foxit Reader")
    WinWaitActive("Foxit Reader")
    $pid = Run(@AutoItExe & ' /AutoIt3ExecuteLine "' & $command & '"') ; doesn't perform the $command if compiled
    If WinWait("Browse For Folder", "", 3) Then ; timeout DOES occur when the above command doesn't execute even if compiled
        ProcessClose($pid)
        ControlSetText("Browse For Folder", "", "[CLASS:Edit; INSTANCE:1]", "\\inet\acis", 1)
    Else
        msgbox(0,"","Timed out waiting for the ""Browse For Folder"" window.")
        Exit
    EndIf
    ConsoleWrite("test 1" & @CRLF)
EndFunc
Edited by Mechaflash

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

If anyone has any suggestions, please post. I went ahead and just compiled the command in its own executable and ran it in that manner... but I'd rather just be able to run the one liner in the running application.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

Not sure...I use this in my compiled scripts...it uses handles, and works everytime (sendcommandid, rather than select string, but the results should be the same):

$sPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine "ControlCommand ( hwnd(' & $hCallersWindow & '),'''', hwnd(' & $hCallersToolbar & '), ''SendCommandID'', ' & $iCallersCommandID & ' )"')

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0