DMacy Posted February 25, 2012 Share Posted February 25, 2012 I am new to AutoIt. I'm trying to automate some tasks with Adobe FrameMaker. I'm starting with the following in my script: WinActivate("[CLASS:FrameFamily7.0MdiFrame]") WinWaitActive("[CLASS:FrameFamily7.0MdiFrame]") If WinActive("[CLASS:FrameFamily7.0MdiFrame]") Then Send("{ALT}") Send("FO") Send("C:\MyFrameDoc.fm") Send("{TAB}") Send("{TAB}") Send("{ENTER}") Sleep(1000) If FileExists("C:\MyFrameDoc.mif") Then FileDelete("C:\MyFrameDoc.mif") EndIf Send("{ALT}") Send("FA") Send("C:\MyFrameDoc.mif") Send("{TAB}") Send("MIF") Send("{TAB}") Send("{ENTER}") Sleep(1000) Send("{ALT}") Send("FC") EndIf I've tried each of the following for the first line, one at a time, using the same parameter(s) in each of the first three functions: WinActivate("Adobe FrameMaker") WinActivate("[TITLE:Adobe FrameMaker]") WinActivate("[CLASS:FrameFamily7.0MdiFrame]") WinActivate("[TITLE:Adobe FrameMaker; CLASS:FrameFamily7.0MdiFrame]") WinActivate("[TITLE:Adobe FrameMaker; CLASS:FrameFamily7.0MdiFrame]", "") I've used the AutoIt Window Info application with FrameMaker running and confirmed the title as "Adobe FrameMaker" and that's where I copied the class parameter from. Yet nothing I've tried will activate FrameMaker. If FrameMaker is already running before I execute the script, the rest of the script works fine. Can someone help me get FrameMaker activated if it's not when I start the script? Thanks! Link to comment Share on other sites More sharing options...
wakillon Posted February 26, 2012 Share Posted February 26, 2012 Try to add this part at the begining Global $_HWnd Do $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") Until $_HWnd <> 0 AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
DMacy Posted February 26, 2012 Author Share Posted February 26, 2012 Thank you for the suggestion. Unfortunately, it didn't make any difference. I get an icon in my system tray that says "Script Paused" with a checkmark beside it. Here is my complete script: Global $_HWnd Do $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") Until $_HWnd <> 0 If WinActive("[CLASS:FrameFamily7.0MdiFrame]") Then MsgBox(0, "Test", "FrameMaker activated!") EndIf Any other suggestions? Link to comment Share on other sites More sharing options...
somdcomputerguy Posted February 26, 2012 Share Posted February 26, 2012 So try it with ControlSend instead of Send. Then the app doesn't need to be active (just running). - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
wakillon Posted February 27, 2012 Share Posted February 27, 2012 Thank you for the suggestion. Unfortunately, it didn't make any difference. I get an icon in my system tray that says "Script Paused" with a checkmark beside it. Here is my complete script:Any other suggestions?Try Debug mode and you will find where it blocks : #AutoIt3Wrapper_Run_Debug_Mode=Y AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
DMacy Posted February 27, 2012 Author Share Posted February 27, 2012 I added the debug statement at the beginning of my script, but nothing different happens. I'm clicking on my au3 file in Windows Explorer, and I get an icon in my taskbar tray that says the script is paused, but no other windows. Where should I see the debug output? Link to comment Share on other sites More sharing options...
wakillon Posted February 27, 2012 Share Posted February 27, 2012 I added the debug statement at the beginning of my script, but nothing different happens. I'm clicking on my au3 file in Windows Explorer, and I get an icon in my taskbar tray that says the script is paused, but no other windows. Where should I see the debug output?In the Console Output of SciTE Editorfor see it, click on : Tools / SyntaxCheck Prod AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
DMacy Posted February 27, 2012 Author Share Posted February 27, 2012 I don't have the SciTE Editor. Do I need to install it in order to debug AutoIt scripts? I'm running Windows 7 Professional. Link to comment Share on other sites More sharing options...
wakillon Posted February 27, 2012 Share Posted February 27, 2012 I don't have the SciTE Editor. Do I need to install it in order to debug AutoIt scripts? I'm running Windows 7 Professional.Yes, SciTE Editor is the best, you can get it here ; http://www.autoitscript.com/site/autoit-script-editor/downloads/ AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
DMacy Posted February 27, 2012 Author Share Posted February 27, 2012 I downloaded and installed the editor. When I choose Tools > Go, I get the following in the output window: >"C:\Program Files\AutoIt 3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\BTP\TestAutoIt.au3" /UserParams +>16:46:07 Starting AutoIt3Wrapper v.2.1.0.8 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X86) >Running AU3Check (1.54.22.0) from:C:\Program Files\AutoIt 3 +>16:46:08 AU3Check ended.rc:0 >Running:(3.3.8.1):C:\Program Files\AutoIt 3\autoit3.exe "C:\BTP\TestAutoIt.au3" !> Starting in DebugMode.. Line: @error-@extended: Line syntax 0001: 0-0: #AutoIt3Wrapper_Run_Debug_Mode=Y 0003: 0-0: Global $_HWnd 0005: 0-0: Do 0006: 0-0: $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") 0007: 0-0: Until $_HWnd <> 0 0006: 0-0: $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") 0007: 0-0: Until $_HWnd <> 0 0006: 0-0: $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") 0007: 0-0: Until $_HWnd <> 0 0006: 0-0: $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") 0007: 0-0: Until $_HWnd <> 0 0006: 0-0: $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") 0007: 0-0: Until $_HWnd <> 0 0006: 0-0: $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") 0007: 0-0: Until $_HWnd <> 0 0006: 0-0: $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") 0007: 0-0: Until $_HWnd <> 0 0006: 0-0: $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") 0007: 0-0: Until $_HWnd <> 0 0006: 0-0: $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame]") It kept repeating the last two lines till I chose Tools > Stop Executing. Does this give any clues about what's wrong and how to get FrameMaker activated if it's not running already? Link to comment Share on other sites More sharing options...
wakillon Posted February 28, 2012 Share Posted February 28, 2012 So you know now that [CLASS:FrameFamily7.0MdiFrame] is not good... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
DMacy Posted February 28, 2012 Author Share Posted February 28, 2012 I also tried "Adobe FrameMaker" for the WinActivate parameter but got the same infinite loop. How can I find out how to identify the program to activate it? Link to comment Share on other sites More sharing options...
wakillon Posted February 28, 2012 Share Posted February 28, 2012 I didn't have Adobe FrameMaker installed, so i can't try to find the good title or class.Run your FrameMaker soft, wait window appears and run this script for see in the SciTE console for Adobe FrameMaker title or class. #include <Array.au3> $_WinList = WinList ( ) For $_I = 1 To UBound ( $_WinList ) -1 If $_WinList[$_I][0] <> '' Then $_Classname = _WinGetClassName ( $_WinList[$_I][1] ) If $_Classname Then ConsoleWrite ( '-->-- Title : ' & $_WinList[$_I][0] & @Crlf ) ConsoleWrite ( '+->-- Classname : ' & $_Classname & @Crlf ) EndIf EndIf Next Func _WinGetClassName ( $hWnd ) If Not IsHWnd ( $hWnd ) Then $hWnd = WinGetHandle ( $hWnd ) $aClassName = DLLCall ( "user32.dll", "int", "GetClassName", "hWnd", $hWnd, "str", "", "int", 64 ) If Not @error And $aClassName[0] <> 0 Then Return $aClassName[2] EndFunc ;==> _WinGetClassName ( ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
DMacy Posted February 28, 2012 Author Share Posted February 28, 2012 Here are the contents of the Output window: >"C:\Program Files\AutoIt 3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\BTP\Debug FM AutoIt.au3" /UserParams +>10:06:04 Starting AutoIt3Wrapper v.2.1.0.8 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X86) >Running AU3Check (1.54.22.0) from:C:\Program Files\AutoIt 3 +>10:06:04 AU3Check ended.rc:0 >Running:(3.3.8.1):C:\Program Files\AutoIt 3\autoit3.exe "C:\BTP\Debug FM AutoIt.au3" -->-- Title : SciTE interface +->-- Classname : AutoIt v3 GUI -->-- Title : Start +->-- Classname : Button -->-- Title : CiceroUIWndFrame +->-- Classname : CiceroUIWndFrame -->-- Title : Dan +->-- Classname : Desktop User Picture -->-- Title : Start menu +->-- Classname : DV2ControlHost -->-- Title : CiceroUIWndFrame +->-- Classname : CiceroUIWndFrame -->-- Title : TF_FloatingLangBar_WndTitle +->-- Classname : CiceroUIWndFrame -->-- Title : Network Flyout +->-- Classname : ATL:6A148158 -->-- Title : Task Switching +->-- Classname : TaskSwitcherWnd -->-- Title : AutoIt v3 +->-- Classname : AutoIt v3 -->-- Title : AutoIt v3 +->-- Classname : AutoIt v3 -->-- Title : C:\BTP\Debug FM AutoIt.au3 - SciTE +->-- Classname : SciTEWindow -->-- Title : DirectorExtension +->-- Classname : DirectorExtension -->-- Title : SciTE_SingleThreadExtension_Dispatcher +->-- Classname : Static -->-- Title : DDE Server Window +->-- Classname : OleDdeWndClass -->-- Title : Font Capture +->-- Classname : CoolTypeFontChange -->-- Title : MCI command handling window +->-- Classname : #43 -->-- Title : GDI+ Window +->-- Classname : GDI+ Hook Window Class -->-- Title : MS_WebcheckMonitor +->-- Classname : MS_WebcheckMonitor -->-- Title : Keys Up Or Down +->-- Classname : TDoKeyUpDown -->-- Title : Order Entry +->-- Classname : TMyOrder -->-- Title : MainWin +->-- Classname : TMainWin -->-- Title : Keyboard Express 95/NT +->-- Classname : TApplication -->-- Title : CTrayNotifyIcon Helper Window +->-- Classname : TrayNotifyIconClass -->-- Title : EaseUSTray +->-- Classname : AfxFrameOrView90u -->-- Title : Notification Wnd for RNAdmin +->-- Classname : RNAdminNotifWndClass -->-- Title : EuWatch +->-- Classname : EUWATCH -->-- Title : Card reader disk icon +->-- Classname : USBestICON -->-- Title : Logitech Webcam Help +->-- Classname : QWidget -->-- Title : LWS +->-- Classname : QWidget -->-- Title : LWS +->-- Classname : QWidget -->-- Title : HiddenFaxWindow +->-- Classname : FaxMonWinClass{3FD224BA-8556-47fb-B260-3E451BAE2793} -->-- Title : BluetoothNotificationAreaIconWindowClass +->-- Classname : BluetoothNotificationAreaIconWindowClass -->-- Title : Setpoint Gaming Notification Window +->-- Classname : Setpoint Gaming Notification Window Class -->-- Title : KHALHIDC_MainWindow +->-- Classname : KHALHIDC_MainWindow -->-- Title : KHALHIDC_MainWindow +->-- Classname : KHALHIDC_MainWindow -->-- Title : KHALHIDC_MainWindow +->-- Classname : KHALHIDC_MainWindow -->-- Title : KHALMOU_MainWindow +->-- Classname : KHALMOU_MainWindow -->-- Title : KHALHIDN_MainWindow +->-- Classname : KHALHIDN_MainWindow -->-- Title : KHALHIDC_MainWindow +->-- Classname : KHALHIDC_MainWindow -->-- Title : KHALHIDM_MainWindow +->-- Classname : KHALHIDM_MainWindow -->-- Title : KHALUSB_MainWindow +->-- Classname : KHALUSB_MainWindow -->-- Title : KHALHPP_MainWindow +->-- Classname : KHALHPP_MainWindow -->-- Title : KHALITouch_MainWindow +->-- Classname : KHALITouch_MainWindow -->-- Title : KHALMouseware_MainWindow +->-- Classname : KHALMouseware_MainWindow -->-- Title : KHALMainProcessWindow +->-- Classname : KHALMainProcessWindow -->-- Title : Media Center SSO +->-- Classname : Media Center SSO -->-- Title : Battery Meter +->-- Classname : SystemTray_Main -->-- Title : AcrobatTrayIcon +->-- Classname : AcrobatTrayIcon -->-- Title : CAvastTrayIcon +->-- Classname : asw_av_tray_icon_wndclass -->-- Title : .NET-BroadcastEventwindow.2.0.0.0.33c0d9d.0 +->-- Classname : .NET-BroadcastEventwindow.2.0.0.0.33c0d9d.0 -->-- Title : Jump List +->-- Classname : DV2ControlHost -->-- Title : DDE Server Window +->-- Classname : OleDdeWndClass -->-- Title : GDI+ Window +->-- Classname : GDI+ Hook Window Class -->-- Title : .NET-BroadcastEventwindow.2.0.0.0.3d893c.0 +->-- Classname : .NET-BroadcastEventwindow.2.0.0.0.3d893c.0 -->-- Title : AMD:CCC-AEMCapturingWindow +->-- Classname : WindowsForms10.window.8.app.0.3d893c -->-- Title : LVDMClientWnd +->-- Classname : LVDMClientWnd -->-- Title : LVDMClientWnd +->-- Classname : LVDMClientWnd -->-- Title : LVDMClientWnd +->-- Classname : LVDMClientWnd -->-- Title : CameraHelperShell +->-- Classname : QWidget -->-- Title : CameraHelperShell +->-- Classname : QWidget -->-- Title : COCIHiddenwindow +->-- Classname : COCIManager_proc -->-- Title : LVDMClientWnd +->-- Classname : LVDMClientWnd -->-- Title : LVDMClientWnd +->-- Classname : LVDMClientWnd -->-- Title : LVDMClientWnd +->-- Classname : LVDMClientWnd -->-- Title : DDE Server Window +->-- Classname : OleDdeWndClass -->-- Title : DDE Server Window +->-- Classname : OleDdeWndClass -->-- Title : MCI command handling window +->-- Classname : #43 -->-- Title : Task Host Window +->-- Classname : COMTASKSWINDOWCLASS -->-- Title : AMD EEU Client +->-- Classname : AMD EEU Client -->-- Title : DWM Notification Window +->-- Classname : Dwm -->-- Title : FrameMaker Console +->-- Classname : MakerConsClass -->-- Title : Adobe FrameMaker +->-- Classname : FrameFamily7.0MdiFrame -->-- Title : Program Manager +->-- Classname : Progman -->-- Title : MSCTFIME UI +->-- Classname : MSCTFIME UI -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : MSCTFIME UI +->-- Classname : MSCTFIME UI -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : MSCTFIME UI +->-- Classname : MSCTFIME UI -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : MSCTFIME UI +->-- Classname : MSCTFIME UI -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : Default IME +->-- Classname : IME -->-- Title : MSCTFIME UI +->-- Classname : MSCTFIME UI -->-- Title : Default IME +->-- Classname : IME -->-- Title : MSCTFIME UI +->-- Classname : MSCTFIME UI -->-- Title : Default IME +->-- Classname : IME +>10:06:05 AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 1.976 For FrameMaker, it looks like exactly what I've been trying without success. Link to comment Share on other sites More sharing options...
wakillon Posted February 28, 2012 Share Posted February 28, 2012 Yes it's strange. try with "[CLASS:FrameFamily7.0MdiFrame;TITLE:Adobe FrameMaker]" AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
DMacy Posted February 28, 2012 Author Share Posted February 28, 2012 #AutoIt3Wrapper_Run_Debug_Mode=Y Global $_HWnd Do $_HWnd = WinActivate("[CLASS:FrameFamily7.0MdiFrame;TITLE:Adobe FrameMaker]") Until $_HWnd <> 0 If WinActive("[CLASS:FrameFamily7.0MdiFrame;TITLE:Adobe FrameMaker]") Then MsgBox(0, "Test", "FrameMaker activated!") EndIf The Do loop runs without stopping till I enter Ctrl-Break. Link to comment Share on other sites More sharing options...
wakillon Posted February 28, 2012 Share Posted February 28, 2012 It's my last hope... #AutoIt3Wrapper_Run_Debug_Mode=Y Global $_HWnd, $_Winhandle $_WinList = WinList ( '[CLASS:FrameFamily7.0MdiFrame]' ) For $_I = 1 To UBound ( $_WinList ) -1 If $_WinList[$_I][0] <> '' Then ConsoleWrite ( '-->-- Title : ' & $_WinList[$_I][0] & @Crlf ) ConsoleWrite ( '+->-- hwnd : ' &$_WinList[$_I][1] & @Crlf ) $_AFWinhandle = $_WinList[$_I][1] ExitLoop EndIf Next Do $_HWnd = WinActivate ( $_AFWinhandle ) Until $_HWnd <> 0 AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
DMacy Posted February 28, 2012 Author Share Posted February 28, 2012 Maybe we're getting somewhere! Here is the script I ran: #AutoIt3Wrapper_Run_Debug_Mode=Y Global $_HWnd, $_Winhandle, $_AFWinhandle $_WinList = WinList('[CLASS:FrameFamily7.0MdiFrame]') For $_I = 1 To UBound($_WinList) - 1 If $_WinList[$_I][0] <> '' Then ConsoleWrite('-->-- Title : ' & $_WinList[$_I][0] & @CRLF) ConsoleWrite('+->-- hwnd : ' & $_WinList[$_I][1] & @CRLF) $_AFWinhandle = $_WinList[$_I][1] ExitLoop EndIf Next Do $_HWnd = WinActivate($_AFWinhandle) Until $_HWnd <> 0 If WinActive($_AFWinhandle) Then MsgBox(0, "Test", "FrameMaker activated!") Send("{Alt}FO") Else MsgBox(0, "Test", "FrameMaker did not activate.") EndIf I had to add $_AFWinhandle to the Global line to get it to execute properly. Then I added the message boxes at the end, and it displays the first (that it activated). However, the keystrokes that I then send brought up the File Open dialog in the SciTE editor, not in FrameMaker. And even though it says FrameMaker is activated, I don't see the program window or its icon in the tray. Here's the Output window contents from executing the above script: >"C:\Program Files\AutoIt 3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\BTP\Debug2.au3" /UserParams +>13:20:54 Starting AutoIt3Wrapper v.2.1.0.8 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X86) >Running AU3Check (1.54.22.0) from:C:\Program Files\AutoIt 3 +>13:20:54 AU3Check ended.rc:0 >Running:(3.3.8.1):C:\Program Files\AutoIt 3\autoit3.exe "C:\BTP\Debug2.au3" !> Starting in DebugMode.. Line: @error-@extended: Line syntax 0001: 0-0: #AutoIt3Wrapper_Run_Debug_Mode=Y 0003: 0-0: Global $_HWnd, $_Winhandle, $_AFWinhandle 0005: 0-0: $_WinList = WinList("[CLASS:FrameFamily7.0MdiFrame]") 0006: 0-0: For $_I = 1 To UBound($_WinList) - 1 0015: 0-0: Do 0016: 0-0: $_HWnd = WinActivate($_AFWinhandle) 0017: 0-1: Until $_HWnd <> 0 0019: 0-1: If WinActive($_AFWinhandle) Then 0020: 0-0: MsgBox(0, "Test", "FrameMaker activated!") 0021: 0-0: Send("{Alt}FO") 0022: 0-0: Else +>13:20:56 AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 3.631 I don't have to see the program window, but I just need to send the keystrokes to it and not some other program. Link to comment Share on other sites More sharing options...
DMacy Posted March 1, 2012 Author Share Posted March 1, 2012 I'm still stuck because, even though the script says FrameMaker is activated, the window is not displayed and subsequent commands are not interpreted by FrameMaker but by the script editor. Any more ideas? Link to comment Share on other sites More sharing options...
somdcomputerguy Posted March 1, 2012 Share Posted March 1, 2012 I don't have to see the program window, but I just need to send the keystrokes to it and not some other program.So try it with ControlSend instead of Send. Then the app doesn't need to be active (just running). - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. 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