Jump to content

Read Tab Name on Mulit-Tab Programs...


jfcby
 Share

Recommended Posts

Hello,

In my batch print program that I'm creating for AutoDesk DWG TrueView 2007 sometimes has multi-tabs for a single file. I researched the Au3Info.exe to see if it had the tab name but did not find it. Is there a way to use WinActivate to set focus to a window and tab name?

Added Aug 26, 2008, 10:54pm:

Through futher research I found out using the Au3Info.exe program that the tab control is called AcadSoftelTabControl32 and the tab names are displayed in the Visible Text Tab as <Switching to: Model>, <Switching to: 2245-1>, <Switching to: 2245-1>. Is there a way to Activate a window using the tab name?

Thank you for your help,

jfcby

Edited by jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

jfcby

Look to GuiTab Management in the help file.

Hello rasim,

I looked in the help file and could not find any reference to the GuiTab Management. Are there some references and help for the GuiTab somewhere else I can use?

Thank you for your help,

jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

jfcby

In the User Defined Function Reference

rasim

I've studied the User Defined Function Reference and also the references in this forum. Most of the references are for Autoit3 created tabs and not for external program tabs.

In the following code how do I get it to:

1. Show the number of tabs in a external program (AutoDesk DWG TrueView):

MsgBox(4160, "Information", "Number of tabs: " & _GUICtrlTab_GetItemCount($cntTab))

2. Get the current selected tab in a external program (AutoDesk DWG TrueView):

MsgBox(4160, "Information", "Current Selection: " & _GUICtrlTab_GetCurSel($cntTab))

Full Code:

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiTab.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
$AppTitle = "DWG TrueView Print"
$mainwindow = GUICreate($AppTitle, 250, 100, 675, 50)
HotKeySet("{ESC}", "_Quit")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit");"CLOSEClicked")
GUICtrlCreateLabel("Print DWG TrueView Active window.", 30, 10)
$printbutton = GUICtrlCreateButton("Print", 90, 50, 75, 25)
GUICtrlSetOnEvent($printbutton, "PrintButton")
$tabbutton = GUICtrlCreateButton("Tab", 10, 50, 75, 25)
GUICtrlSetOnEvent($tabbutton, "TabButton")
GUISetState(@SW_SHOW)
WinSetOnTop($AppTitle, "", 1);window stays on top

While 1
  Sleep(1000) ; Idle around
WEnd

Func TabButton()
    WinActivate("DWG TrueView", "z:\")
    Sleep(2000)
    $cntTab = ControlCommand("DWG TrueView", "z:\", "AcadSoftelTabControl321", "TabRight", "")
; Show number of tabs
    Sleep(2000)
    MsgBox(4160, "Information", "Number of tabs: " & _GUICtrlTab_GetItemCount($cntTab))
    
; Get Current Selected Tab  
    Sleep(2000)
    MsgBox(4160, "Information", "Current Selection: " & _GUICtrlTab_GetCurSel($cntTab))
EndFunc

Func PrintButton()  
    WinActivate("DWG TrueView", "z:\")
    Sleep(2000)
    
;Print Active Page
    Send("{ALT}" & "{DOWN 5}" & "{ENTER}")
    Sleep(2000)
    Send("{ENTER}");File > Plot(Print)
    Sleep(2000)
    Send("+{TAB 4}" & "{DOWN}" & "{ENTER}");Page Setup > Previous Plot(Print)   
EndFunc

Func _Quit();CLOSEClicked()  
  Exit
EndFunc

Thank you for your help,

jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

All GUI UDF functions work also with external applications.

#include <GUIConstantsEx.au3>#include <WinAPI.au3>
#include <GuiTab.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
$AppTitle = "DWG TrueView Print"
$mainwindow = GUICreate($AppTitle, 250, 100, 675, 50)
HotKeySet("{ESC}", "_Quit")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit");"CLOSEClicked")
GUICtrlCreateLabel("Print DWG TrueView Active window.", 30, 10)
$printbutton = GUICtrlCreateButton("Print", 90, 50, 75, 25)
GUICtrlSetOnEvent($printbutton, "PrintButton")
$tabbutton = GUICtrlCreateButton("Tab", 10, 50, 75, 25)
GUICtrlSetOnEvent($tabbutton, "TabButton")
GUISetState(@SW_SHOW)
WinSetOnTop($AppTitle, "", 1);window stays on top

$HwndTab = ControlGetHandle("DWG TrueView", "z:\", "AcadSoftelTabControl321")

While 1
  Sleep(1000) ; Idle around
WEnd

Func TabButton()
    WinActivate("DWG TrueView", "z:\")
    Sleep(2000)
    $cntTab = ControlCommand("DWG TrueView", "z:\", "AcadSoftelTabControl321", "TabRight", "")
; Show number of tabs
    Sleep(2000)
    MsgBox(4160, "Information", "Number of tabs: " & _GUICtrlTab_GetItemCount($HwndTab))
    
; Get Current Selected Tab    
    Sleep(2000)
    MsgBox(4160, "Information", "Current Selection: " & _GUICtrlTab_GetCurSel($HwndTab))
EndFunc

Func PrintButton()  
    WinActivate("DWG TrueView", "z:\")
    Sleep(2000)
    
;Print Active Page
    Send("{ALT}" & "{DOWN 5}" & "{ENTER}")
    Sleep(2000)
    Send("{ENTER}");File > Plot(Print)
    Sleep(2000)
    Send("+{TAB 4}" & "{DOWN}" & "{ENTER}");Page Setup > Previous Plot(Print)    
EndFunc

Func _Quit();CLOSEClicked()  
  Exit
EndFunc
Edited by Zedna
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...