Jump to content
Sign in to follow this  
jfcby

Read Tab Name on Mulit-Tab Programs...

Recommended Posts

jfcby

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 ****

Share this post


Link to post
Share on other sites
rasim

jfcby

Look to GuiTab Management in the help file.

Share this post


Link to post
Share on other sites
jfcby

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 ****

Share this post


Link to post
Share on other sites
rasim

jfcby

In the User Defined Function Reference

Share this post


Link to post
Share on other sites
jfcby

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 ****

Share this post


Link to post
Share on other sites
Zedna

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

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  

×