jfred Posted December 23, 2010 Share Posted December 23, 2010 Hello scripters, I am attempting to make a script to automate a daily task, as most of try to do. The problem I am running across is a active hidden window and unable to bring it to the front or on top of the current/parent window. In the application when it gets to the point of the choosing to print a report or importing data from a csv file. The window that has these options is active and hidden behind the window at time of selecting to do this task. The window has a name/title. I have used the AutoIt Info tool and it does not find the name/title of the window, and very little other information from that window other then the button labels, "apply data", "print report" and "exit". My script will run the application and get to that point, and not able to get the hidden window forward/on top. If this window is not the one being viewed, you can not proceed with selecting your print or apply options. Any suggestions? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 23, 2010 Moderators Share Posted December 23, 2010 jfred,Welcome to the AutoIt forum. Just leave the title blank in the WinActivate command and use some of the visible text - as long as it is unique to that window: WinActivate("", "apply data") ; or WinActivate("", "print report") ; but probably not WinActivate("", "exit")M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jfred Posted December 23, 2010 Author Share Posted December 23, 2010 Thank M23 I will give it go. The only issue is that if the command is not interpreted correctly (gets botched) it will import the CSV file, which means extra work correcting duplicate entries. I will let you know how it went. JF Link to comment Share on other sites More sharing options...
jfred Posted December 23, 2010 Author Share Posted December 23, 2010 M23 I gave it go, with no success. The window still remains hidden behind the other one. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 23, 2010 Moderators Share Posted December 23, 2010 jfred,Pity, it works for me. Do you get any CLASS information from the Window Info tool? Perhaps that is sufficiently unique to use - but do check the other visible GUIs as well to se if that is the case. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jfred Posted December 23, 2010 Author Share Posted December 23, 2010 Attached is a partial screenshot of what I have to work with. I was able this last time to pull some text info, expect I am unable to get that to bring the window forward. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 23, 2010 Moderators Share Posted December 23, 2010 jfred, OK, brimming with optimism, we now try: WinActivate("", "[CLASS:AfxWnd;INSTANCE:2]") WinWaitActive("", "[CLASS:AfxWnd;INSTANCE:2]") That way we wait until it comes forward before we try to do anything to it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jfred Posted December 23, 2010 Author Share Posted December 23, 2010 M23 I remarked out was done before, and added the 2 lines you provided. What happens now is the window still stays hidden, and the patent/first window, goes back to being active in the task bar and the script hangs. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 24, 2010 Moderators Share Posted December 24, 2010 jfred,My apologies, there was a stupid error in that last suggestion - I used the control CLASS and not that of the GUI, so it was hardly surprising that it did not work! So, remaining just as optimistic, we try:WinActivate("", "[CLASS:ThunderForm]") WinWaitActive("", "[CLASS:ThunderForm]")Despite my ever-present optimism, I wonder if that is sufficently unique. If not, then we will try looking at the size as well - it does always come up the same size, I hope: WinActivate("", "[CLASS:ThunderForm;W:1442;H:902]") WinWaitActive("", "[CLASS:ThunderForm;W:1442;H:902]")Fingers firmly crossed! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jfred Posted December 28, 2010 Author Share Posted December 28, 2010 M23 there are no worries. I will try the new code some time today and post back. Thanks. Link to comment Share on other sites More sharing options...
jfred Posted December 28, 2010 Author Share Posted December 28, 2010 M23 I just tried both sets of scirpt lines you recently provided, still no go. The hidden active window stays behind the other window and the script hangs. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 28, 2010 Moderators Share Posted December 28, 2010 jfred,A final throw of the dice! Does the hidden window "stick out" at all? Is there any part of it visible upon which we could click to get it to the front? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
rover Posted December 29, 2010 Share Posted December 29, 2010 jfred try WinSetOnTop() or _WinAPI_SetWindowPos() see if this sets the dialog on top run with hidden (bottom of z-order) ThunderForm dialog open expandcollapse popup#include <WinAPI.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <Constants.au3> ;#include <_EnumChildWindows.au3> ;#Include <WinAPIEx.au3> Opt("MustDeclareVars", 1) _CFAWinTest() Func _CFAWinTest() Local $hWndMain, $hWndTForm = 0, $hWndDlg = 0, $PID, $iTime, $aDlgList, $sText Local $sProcName = "CFAWin.exe" ;target app process name Local $sMainTitle = "CFAWin v.7.0.1065" ;;target app partial title Local $sMainTitleRegx = "[REGEXPTITLE:CFAWin v\.7\.0\.1065.?]" ;target app partial title Local $sClassDlg = "[CLASS:ThunderForm]" ;target dialog class Local $sClassDlgChild = "[CLASS:AfxWnd; INSTANCE:2]" ;target dialog child class/instance Local $sClassDlgTxt = "AfxWnd";target dialog child class text Local $sDlgText = "Current Fuel Transaction" ;target dialog text ;if multiple instances not allowed then use this ;$PID = ProcessExists($sProcName) ;If $PID = 0 Then Exit ConsoleWrite("! Error: No instance of "&$sProcName&" running!" & @CRLF) ;multiple instance check - get PID of parent window Local $aProcList = ProcessList($sProcName) If @error Or IsArray($aProcList) = 0 Then Exit ConsoleWrite("! Error: Failed to retrieve process list!" & @CRLF) If $aProcList[0][0] = 0 Then Exit ConsoleWrite("! Error: No instance of " & $sProcName & " running!" & @CRLF) If $aProcList[0][0] > 1 Then Exit ConsoleWrite("! Error: Multiple instances of " & $sProcName & " running!" & @CRLF) If $aProcList[1][1] = 0 Then Exit $PID = $aProcList[1][1] WinActivate($sMainTitleRegx) WinWaitActive($sMainTitleRegx, "", 10) $hWndMain = WinGetHandle($sMainTitleRegx) If IsHWnd($hWndMain) = 0 Or WinGetProcess($hWndMain) <> $PID Or StringInStr(WinGetTitle($hWndMain), $sMainTitle) = 0 Then ConsoleWrite("! Error: Failed to retrieve handle for CFAWin window: " & $hWndMain & @CRLF) Exit EndIf ;get CFAWin96 Automatic Fuel Interface parent window of AfxWnd window ;another window info tool may show a title for that ThunderForm class window, try this: ;$hWndTForm = WinGetHandle("[TITLE:CFAWin96 Automatic Fuel Interface]") ;ConsoleWrite("-ThunderForm Dialog Handle: " & $hWndTForm & @CRLF) ;this method will find that window (the app may have other hidden dialogs with that ThunderForm class, or another app could be open with that class). ;enumerate all (visible or not) ThunderForm class windows until the child window of the parent process is found or the timeout expires. $iTime = TimerInit() Do $aDlgList = WinList($sClassDlg);$aDlgList[0][0] = 0 if no matching windows For $i = 1 To $aDlgList[0][0] ;skips this loop if $aDlgList[0][0] = 0 ;If BitAnd(WinGetState($aDlgList[$i][1]), 2) <> 2 Then ContinueLoop ;ignore hidden windows ;verify ThunderForm dialog belongs to parent process and is not parent window if of same class If WinGetProcess($aDlgList[$i][1]) = $PID And _ Number($aDlgList[$i][1]) <> Number($hWndMain) Then ; ThunderForm dialog is a child of parent process $hWndTForm = $aDlgList[$i][1] ConsoleWrite("-ThunderForm Dialog Handle: " & $hWndTForm & @CRLF) ;if ControlGetHandle fails, try Ascend4nt's _EnumChildWindows() ;or Yashied's _WinAPI_EnumChildWindows() $hWndDlg = ControlGetHandle($hWndTForm, "", $sClassDlgChild) If IsHWnd($hWndDlg) = 0 Or _WinAPI_GetClassName($hWndDlg) <> $sClassDlgTxt Then ;If IsHWnd($hWndDlg) = 0 Or _ControlGetClassnameNN($hWndDlg) <> "AfxWnd2" Then ConsoleWrite("! Error: Failed to retrieve AfxWnd dialog handle" & @CRLF) ContinueLoop 1 EndIf ;retrieve all dialog text $sText = ControlGetText($hWndTForm, "", $hWndDlg) If $sText = "" Then $sText = WinGetText($hWndDlg) ConsoleWrite("-AfxWnd2 Dialog: " & $sText & @CRLF) If StringInStr($sText, $sDlgText) = 0 Then ConsoleWrite("! Error: Failed to find AfxWnd class in dialog" & @CRLF) ;ContinueLoop 1 EndIf ExitLoop 2 ;break out of both loops EndIf Next Sleep(50) Until TimerDiff($iTime) >= 6000 ; 6 sec timeout ConsoleWrite("+ThunderForm Dialog Handle: " & $hWndTForm & @CRLF) ConsoleWrite("+AfxWnd Dialog Handle: " & $hWndDlg & @CRLF) If $hWndDlg = 0 Or $hWndTForm = 0 Then Exit ConsoleWrite("! Error: Failed to retrieve handles" & @CRLF) ;_WinAPI_ShowWindow($hWndTForm, @SW_SHOWNORMAL) ;WinSetState($hWndTForm, "", @SW_SHOW) _WinAPI_SetWindowPos($hWndMain, $hWndTForm, 0, 0, 0, 0, BitOR($SWP_SHOWWINDOW, $SWP_NOMOVE, $SWP_NOSIZE)) WinSetOnTop($hWndTForm, "", 1) ;set topmost attribute WinActivate($hWndTForm) ;WinWaitActive($hWndTForm, "", 10) ;_WinAPI_SetFocus($hWndDlg) ;ControlFocus($hWndTForm, "", $hWndDlg) WinSetOnTop($hWndTForm, "", 0) ; remove topmost attribute Exit EndFunc ;==>_CFAWinTest Func _ControlGetClassnameNN($hControl) ;Author: Valik If Not IsHWnd($hControl) Then Return SetError(1, 0, "") ;Local Const $hParent = _WinAPI_GetParent($hControl) Local Const $hParent = _WinAPI_GetAncestor($hControl, $GA_ROOT) If Not $hParent Then Return SetError(2, 0, "") Local Const $sList = WinGetClassList($hParent) Local $aList = StringSplit(StringTrimRight($sList, 1), @LF, 2) _ArraySort($aList) Local $nInstance, $sLastClass, $sComposite For $i = 0 To UBound($aList) - 1 If $sLastClass <> $aList[$i] Then $sLastClass = $aList[$i] $nInstance = 1 EndIf $sComposite = $sLastClass & $nInstance If ControlGetHandle($hParent, "", $sComposite) = $hControl Then Return $sComposite $nInstance += 1 Next Return SetError(3, 0, "") EndFunc ;==>_ControlGetClassnameNN I see fascists... Link to comment Share on other sites More sharing options...
jfred Posted December 29, 2010 Author Share Posted December 29, 2010 Rover I will give it a go. Thanks for the reply. Link to comment Share on other sites More sharing options...
jfred Posted December 29, 2010 Author Share Posted December 29, 2010 I have noticed as the process happens for running the script and the application follows the script; that 2 processes come up at the time of the hidden active window I would like to be forward, wowexec.exe and cfpvcom2.exe. The cfpvcom2.exe is the process for the hidden active window. M23 to answer your question nothing real sticks out other than the tab is in the taskbar and active when manually ran. However I have noticed that when the script runs and get to this point, the "CFAWin v.7.0.1065 (Profile: xxxxx) - [Fuel/Fluid/Meter Entry]" becomes the active tab/window, instead of leaving "CFAWin96 - Automatic Fuel Interface" as the active tab. Once again I will post what happens. Thanks again for the responses in helping me resolve this issue. Link to comment Share on other sites More sharing options...
jfred Posted December 30, 2010 Author Share Posted December 30, 2010 Rover the window still remains hidden. Here is the message when running the script: >11:00:37 AU3Check ended.rc:0 >Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "K:\CFAWIN\cfatest.au3" +ThunderForm Dialog Handle: 0 +AfxWnd Dialog Handle: 0 ! Error: Failed to retrieve handles !>11:05:46 AutoIT3.exe ended.rc:37 >Exit code: 37 Time: 310.852 I also help some of the info I provided in the reply above may help with this. It's items I just noticed, with the 2 process that show up wowexec.exe and cfpvcom2.exe. That the cfpvcom2.exe process belongs to the hidden window. If you end that process the hidden window closes. And a Merry New year to all! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 30, 2010 Moderators Share Posted December 30, 2010 (edited) jfred, Aha, a process name!!!!! So we try to ID the GUI via the process like this - make sure that recalcitrant GUI is there ready to go when you try this as it has to be on screen (even if hidden behind other GUIs): expandcollapse popup#include <Array.au3> ; Array to hold list of GUIs associated with the process Global $aReturnList[1] = [0] ; get Process ID $iPID = ProcessExists("cfpvcom2.exe ") ; Get list of GUIS $aWinList = WinList() ; Run through GUIs to find those associated with the process For $i = 1 To $aWinList[0][0] If $iPID = WinGetProcess($aWinList[$i][1]) Then $aReturnList[0] += 1 _ArrayAdd($aReturnList, $aWinList[$i][1]) EndIf Next If $aReturnList[0] = 0 Then ; Ooops!!!!!!!!!!!!!! MsgBox(0, "Problem", "No GUIs match the process!") Else ; For each of the returned GUIs For $i = 1 To $aReturnList[0] ; Check it is visible If BitAND(WinGetState($aReturnList[$i]), 2) Then ; If so activate WinActivate($aReturnList[$i]) ; Wait 5 secs to see if it is active $iRet = WinWaitActive($aReturnList[$i], "", 5) ; And................ If $iRet <> 0 Then ConsoleWrite("GUI " & $iRet & " activated" & @CRLF) Else ConsoleWrite("GUI " & $iRet & " not activated" & @CRLF) EndIf EndIf Next EndIf And how did we get on? M23 Edit: Typnig! Edited December 30, 2010 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jfred Posted December 30, 2010 Author Share Posted December 30, 2010 M23 the return is "Problem - No GUIs match the process!". I did run the script you provided when the window is present (hidden and not hidden). In task manager I noticed that the "Task name" is "CFAPetroVendInterface". I attempted to use WinActivate("CFAPetroVendInterface", "") WinWaitActive("CFAPetroVendInterface", "Current Fuel Transaction") to see if the window move to top/forward view, no success there either. Link to comment Share on other sites More sharing options...
rover Posted December 30, 2010 Share Posted December 30, 2010 M23 the return is "Problem - No GUIs match the process!". I did run the script you provided when the window is present (hidden and not hidden). In task manager I noticed that the "Task name" is "CFAPetroVendInterface". I attempted to use WinActivate("CFAPetroVendInterface", "") WinWaitActive("CFAPetroVendInterface", "Current Fuel Transaction") to see if the window move to top/forward view, no success there either. as I mentioned in my previous post, try WinSetOnTop or _WinAPI_SetWindowPos() (same API, more options than Native AutoIt function), as WinActivate just sets focus, but not z-order o.k., now we know it's a window from a separate process. you can try getting that window handle by title (CFAPetroVendInterface) or by class (ThunderForm) this example tries both methods expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> #include <Constants.au3> Opt("MustDeclareVars", 1) _CFAWinTest() Func _CFAWinTest() Local $hWndTForm = 0, $hWndDlg = 0, $PID, $iTime, $aDlgList, $sText Local $sProcName = "cfpvcom2.exe" ;target app process name Local $sMainTitle = "[TITLE:CFAPetroVendInterface]" ;target app partial title Local $sClassDlg = "[CLASS:ThunderForm]" ;target dialog class Local $sClassDlgChild = "[CLASS:AfxWnd; INSTANCE:2]" ;target dialog child class/instance Local $sClassDlgTxt = "AfxWnd";target dialog child class text Local $sDlgText = "Current Fuel Transaction" ;target dialog text ;multiple instance check - get PID of parent window Local $aProcList = ProcessList($sProcName) If @error Or IsArray($aProcList) = 0 Then Exit ConsoleWrite("! Error: Failed to retrieve process list!" & @CRLF) If $aProcList[0][0] = 0 Then Exit ConsoleWrite("! Error: No instance of " & $sProcName & " running!" & @CRLF) If $aProcList[0][0] > 1 Then Exit ConsoleWrite("! Error: Multiple instances of " & $sProcName & " running!" & @CRLF) If $aProcList[1][1] = 0 Then Exit $PID = $aProcList[1][1] ;method 1: find CFAPetroVendInterface window by title $hWndTForm = WinGetHandle($sMainTitle) If IsHWnd($hWndTForm) = 1 And WinGetProcess($hWndTForm) = $PID Then ConsoleWrite("-ThunderForm Dialog Handle: " & $hWndTForm & @CRLF) ;WinSetState($hWndTForm, "", @SW_SHOW) ;_WinAPI_SetWindowPos($hWndTForm, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_SHOWWINDOW, $SWP_NOMOVE, $SWP_NOSIZE)) WinSetOnTop($hWndTForm, "", 1) ;set topmost attribute WinActivate($hWndTForm) WinSetOnTop($hWndTForm, "", 0) ; remove topmost attribute $hWndDlg = ControlGetHandle($hWndTForm, "", $sClassDlgChild) If IsHWnd($hWndDlg) = 0 Or _WinAPI_GetClassName($hWndDlg) <> $sClassDlgTxt Then ConsoleWrite("! Error: Failed to retrieve AfxWnd dialog handle" & @CRLF) EndIf $sText = ControlGetText($hWndTForm, "", $hWndDlg) If $sText = "" Then $sText = WinGetText($hWndDlg) ConsoleWrite("-AfxWnd2 Dialog text: " & $sText & @CRLF) If StringInStr($sText, $sDlgText) = 0 Then ConsoleWrite("! Error: Failed to find AfxWnd class in dialog" & @CRLF) EndIf Exit EndIf ConsoleWrite("! Error: Failed to retrieve handle for CFAWin window: " & $hWndTForm & @CRLF) ;now that find CFAPetroVendInterface window method failed... ;method 2: find ThunderForm class of CFAPetroVendInterface window as shown by AU3 window info tool $iTime = TimerInit() Do $aDlgList = WinList($sClassDlg);"[CLASS:ThunderForm]" For $i = 1 To $aDlgList[0][0] If WinGetProcess($aDlgList[$i][1]) = $PID Then $hWndTForm = $aDlgList[$i][1] ConsoleWrite("-ThunderForm Dialog Handle: " & $hWndTForm & @CRLF) ExitLoop 2 ;break out of both loops EndIf Next Sleep(50) Until TimerDiff($iTime) >= 6000 ; 6 sec timeout ;WinSetState($hWndTForm, "", @SW_SHOW) ;_WinAPI_SetWindowPos($hWndTForm, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_SHOWWINDOW, $SWP_NOMOVE, $SWP_NOSIZE)) WinSetOnTop($hWndTForm, "", 1) ;set topmost attribute WinActivate($hWndTForm) ;WinSetOnTop($hWndTForm, "", 0) ; remove topmost attribute $hWndDlg = ControlGetHandle($hWndTForm, "", $sClassDlgChild) If IsHWnd($hWndDlg) = 0 Or _WinAPI_GetClassName($hWndDlg) <> $sClassDlgTxt Then ConsoleWrite("! Error: Failed to retrieve AfxWnd dialog handle" & @CRLF) EndIf ConsoleWrite("+AfxWnd Dialog Handle: " & $hWndDlg & @CRLF) $sText = ControlGetText($hWndTForm, "", $hWndDlg) If $sText = "" Then $sText = WinGetText($hWndDlg) ConsoleWrite("-AfxWnd2 Dialog: " & $sText & @CRLF) If StringInStr($sText, $sDlgText) = 0 Then ConsoleWrite("! Error: Failed to find AfxWnd class in dialog" & @CRLF) EndIf Exit EndFunc ;==>_CFAWinTest I see fascists... Link to comment Share on other sites More sharing options...
jfred Posted January 5, 2011 Author Share Posted January 5, 2011 Rover and M23 I thank you for all your help. I have been able to successfully able to bring the hidden window forward, and able to get to the "print report" option window to open for printing. The unfortunate part of this; when trying to print the report, which looks like a print preview window, is yet another application running. I have contacted the software developers and the print report function is a an older (original) application that they found still works in the most current version. They have no intention to recode/start over a new with this part of the software, to function more like a current windows type application. Bottom line is there no text, titles, class info, reference to buttons, and no shortcut keys to script the print function. It was designed so that the end user had to click on the print button/icon to get the report to print. I have attached a screen grab of the info tool. All the information listed is the same for any area of the window, especially where the print button is. So I do believe I have a a impassable wall in my desire to script a meager daily task. If you have any suggestion on how to get this part of the software to print the report, I am all ears. Other wise I will claim partial victory, with that has come from your help. Thanks again. 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