Hello all,
First post here but I have a lot of experience with other message boards (for Excel, IBM Cognos TM1, ...)
I want to automate a tedious task in IBM Cogos TM1, Turbo Integrator. I can automate almost everything but I am stuck with 1 thing.
A little background
The editor for Turbo Integrator (shown on the picture) is really crap. It's the most basic editor one can imagine.
So I want to copy/paste existing code from Turbo Integrator to Notepad++. I have a language add-on for TM1 in Notepad++.
I also need to remove those 2 lines with #####Generated statements#####
To be able to copy/paste back from Notepad++ to Turbo Integrator, I have a second script.
When copying from Turbo Integrator to Notepad++ I add the Window title of the Turbo Integrator window as the first line in Notepad++. That way, I know which window to use when transferring back the code.
Problem case
However, the Turbo Integrator process has 4 tabs (Prolog, Metadata, Data, Epilog).
If I'm working in Notepad++ and I change the focus in Turbo Integrator to 1 of the other tabs, my AHK script will overwrite code in the wrong tab !
This is a big problem because I might loose 5 to hundreds of lines of coding.
I used the AU3_Spy.exe tool to inspect the tab names (Prolog, Metadata, Data, Epilog).
Until now I could not get the name of the ACTIVE tab (Prolog, Metadata, Data, Epilog).
The spy does not give other information, except for the relative mouse position. (I can use AHK to send a left-click on a relative position if that's useful)
Does anyone a way to know how to retrieve that information: Prolog, Metadata, Data, Epilog ? Just as plain text.
Or any other way such that I can copy back code in the correct tab. I can activate the correct tab first with a single left-click.
Thanks a lot, it's the last step that is missing from my AHK script that saves a LOT of time !
Wim
Former MS Excel Most Valuable Professional
Selecting a tab in another program
Selecting a tab in another program
Last edited by Wigi on 05 Jun 2017, 12:11, edited 2 times in total.
Re: Selecting a tab in another program
So the issue boils down to being able to click the correct tab that you need.
1) It looks like these tabs are in static position. If you record someplace in notepad++ what tab the code came from in TI, I would imagine it would be fine to do a single left-click at the coordinates tied to that tab. If the tab is already active, is there any harm in clicking on the active tab? If there isn't, just make this an action that's always done - click the tab. Whether this click is done when the window is active (CoordMode, Mouse, Window/Relative) or if you use ControlClick to confirm the correct tab while the TI window is inactive is up to you.
2) But that leaves the issue of figuring out what tab is active.
Are there any signatures within the code that clues you in to the type of code it is? You could do a RegEx() or InStr() search for that signature, or if there's any different syntax unique to each.
Alternatively, I would consider a process of saving the TI code you want, then cycling from the first tab to the last tab and retrieving the text and seeing if they are equal. That is, if you're on the Metadata tab, copy it to clipboard. In AHK, copy the clipboard to variable "target" or whatever you want to call it. Then have AHK click on Parameters tab, copy that text to clipboard, and check if (clipboard=target). If it does match, great, you know what tab you're on -- unless it is possible for any two (or more) of those five tabs to have the exact same code for any reason.
The last alternative I can think of is if the active tab, in combination with the four inactive tabs, are visually distinguishable. You can use an ImageSearch to look for 5 images of the tab bar for those 5 tabs to figure out what one is active. That is, to set up, activate Parameters and use snipping tool to take a picture of all 5 tabs, and save it somewhere. Do the same for the other four being active. Then you can use ImageSearch for each of those 5 images, and whichever one comes back with a match, you know that is the currently active tab.
1) It looks like these tabs are in static position. If you record someplace in notepad++ what tab the code came from in TI, I would imagine it would be fine to do a single left-click at the coordinates tied to that tab. If the tab is already active, is there any harm in clicking on the active tab? If there isn't, just make this an action that's always done - click the tab. Whether this click is done when the window is active (CoordMode, Mouse, Window/Relative) or if you use ControlClick to confirm the correct tab while the TI window is inactive is up to you.
2) But that leaves the issue of figuring out what tab is active.
Are there any signatures within the code that clues you in to the type of code it is? You could do a RegEx() or InStr() search for that signature, or if there's any different syntax unique to each.
Alternatively, I would consider a process of saving the TI code you want, then cycling from the first tab to the last tab and retrieving the text and seeing if they are equal. That is, if you're on the Metadata tab, copy it to clipboard. In AHK, copy the clipboard to variable "target" or whatever you want to call it. Then have AHK click on Parameters tab, copy that text to clipboard, and check if (clipboard=target). If it does match, great, you know what tab you're on -- unless it is possible for any two (or more) of those five tabs to have the exact same code for any reason.
The last alternative I can think of is if the active tab, in combination with the four inactive tabs, are visually distinguishable. You can use an ImageSearch to look for 5 images of the tab bar for those 5 tabs to figure out what one is active. That is, to set up, activate Parameters and use snipping tool to take a picture of all 5 tabs, and save it somewhere. Do the same for the other four being active. Then you can use ImageSearch for each of those 5 images, and whichever one comes back with a match, you know that is the currently active tab.
Re: Selecting a tab in another program
I have provided various bits of information re. tab controls, I think that the best solution is probably to use Acc, code for which is at the bottom. Btw it's always worth trying the AccViewer window spy.
Btw did you notice that someone asked a question on tabs, if so, asking a question on that basis, was probably a good idea, because all the info was fresh in my head. Although it could have been coincidence.
Count number of tabs in active window - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=32702
Btw also, how do you feel about official MS help websites, I normally find that they have very poor or counterproductive, even dangerous advice for people, including suggestions like try reinstalling MS Office. Quite often those are exactly the sorts of questions that people on the AHK forum give the *right* answer to.
I find many of the answers to be irresponsible, or that they seem to have had almost no thought put towards them, I would also have to guess that the users have probably never used the said software, based on the responses, is there some pressure to provide some vague, 'might be helpful' response? In summary I see answers from people who appear never to have experienced a non-obvious problem or query re. MS Office.
Best of luck re. tab controls, they can be quite fiddly re. control enumeration, as I showed in one of my examples.
Code: Select all
q:: ;tab control - focus
;e.g. Internet Explorer: Tools, Internet Options
WinGet, hWnd, ID, A
SendMessage, 0x1304,,, SysTabControl321, % "ahk_id " hWnd ;TCM_GETITEMCOUNT := 0x1304
vTabCount := ErrorLevel
MsgBox, % vTabCount
;index is 0-based
Loop, % vTabCount
{
SendMessage, 0x1330, % A_Index-1,, SysTabControl321, % "ahk_id " hWnd ;TCM_SETCURFOCUS := 0x1330
Sleep 100
}
return
w:: ;tab control - get text / is visible
;if I enumerate controls before navigating through them it lists:
;#327701 Advanced
;if I enumerate controls after navigating through them it lists:
;#327701 Advanced
;#327702 General
;#327703 Security
;#327704 Privacy
;#327705 Content
;#327706 Connections
;#327707 Programs
WinGet, hWnd, ID, A
;this control loop method has disadvantages:
;the order and number of controls listed
;depends on the tabs previously and currently focused
vOutput := ""
Loop
{
ControlGet, hCtl, Hwnd,, % "#32770" A_Index, % "ahk_id " hWnd
if !hCtl
break
ControlGetText, vText, % "#32770" A_Index, % "ahk_id " hWnd
vOutput .= "#32770" A_Index "`t" vText "`r`n"
}
MsgBox, % vOutput
ControlGetText, vText, #327701, % "ahk_id " hWnd
ControlGet, vIsVisible, Visible,, #327701, % "ahk_id " hWnd
MsgBox, % vIsVisible " " vText
return
;tab control - get text via TCM_GETITEM:
;[AHK_L] ControlGetTabs() - Scripts and Functions - AutoHotkey Community
;https://autohotkey.com/board/topic/70727-ahk-l-controlgettabs/
;Acc library (MSAA) and AccViewer download links - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
e:: ;tab control - get text/focus tab via the Acc library
ControlGet, hCtl, Hwnd,, SysTabControl321, A
oAcc := Acc_Get("Object", "4", 0, "ahk_id " hCtl)
vSep := "`r`n"
vOutput := ""
Loop, % oAcc.accChildCount
vOutput .= oAcc.accName(A_Index) vSep
vOutput := SubStr(vOutput, 1, -StrLen(vSep))
MsgBox, % vOutput
oAcc.accDoDefaultAction(4)
oAcc := ""
return
Count number of tabs in active window - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=32702
Btw also, how do you feel about official MS help websites, I normally find that they have very poor or counterproductive, even dangerous advice for people, including suggestions like try reinstalling MS Office. Quite often those are exactly the sorts of questions that people on the AHK forum give the *right* answer to.
I find many of the answers to be irresponsible, or that they seem to have had almost no thought put towards them, I would also have to guess that the users have probably never used the said software, based on the responses, is there some pressure to provide some vague, 'might be helpful' response? In summary I see answers from people who appear never to have experienced a non-obvious problem or query re. MS Office.
Best of luck re. tab controls, they can be quite fiddly re. control enumeration, as I showed in one of my examples.
Last edited by jeeswg on 05 Jun 2017, 12:04, edited 4 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Selecting a tab in another program
Hello Exaskryz
Thank you for your comments.
1) I can confirm what you wrote. And I can already click on a tab (it works). So you are right, the idea is to save the tab name on the first line of Notepad++ and I copy back everything except for the first line.
2) True, the challenge is to get the active tab. I thought about the 2 first suggestions as well. ImageSearch is new to me, I will look at that.
As for the signature: no, it's all plain text. While some statements can only occur on 1 tab, there is not guarantee whatsoever. Also, tabs can be empty (except for the 2 ###generated statements####) so comparing text in tab is not feasible.
Suggestion 2 seems to be the most valuable one, but tabs can be empty. And actually we want them to be empty because Turbo Integrator is an ETL tool and if there is any code in a tab, TI will process the data source (large relational tables e.g.) while it might not be needed.
Is there a way to save the text contents of a tab in the clipboard or a variable, without doing an explicit copy action (like sending ^a and then ^c ) ?
Thanks a lot !
Thank you for your comments.
1) I can confirm what you wrote. And I can already click on a tab (it works). So you are right, the idea is to save the tab name on the first line of Notepad++ and I copy back everything except for the first line.
2) True, the challenge is to get the active tab. I thought about the 2 first suggestions as well. ImageSearch is new to me, I will look at that.
As for the signature: no, it's all plain text. While some statements can only occur on 1 tab, there is not guarantee whatsoever. Also, tabs can be empty (except for the 2 ###generated statements####) so comparing text in tab is not feasible.
Suggestion 2 seems to be the most valuable one, but tabs can be empty. And actually we want them to be empty because Turbo Integrator is an ETL tool and if there is any code in a tab, TI will process the data source (large relational tables e.g.) while it might not be needed.
Is there a way to save the text contents of a tab in the clipboard or a variable, without doing an explicit copy action (like sending ^a and then ^c ) ?
Thanks a lot !
Re: Selecting a tab in another program
Thank you jeeswg too !
Indeed, I looked at that topic, and tried some of the suggestions. The tab count was always 1 (instead of 5 I would think).
I will put more effort in my tests, though, and trying to understand what the scripts are doing. The spy was not helpful for me (in this case) and it's due to TM1 I guess, not due to the spy.
MS help websites are indeed rather poor (at least for Excel, my forte) and I tend to go to the well-known message boards rather than to MS websites.
Sometimes people are keen on gathering many posts, even if it's bullshit they're writing.
Indeed, I looked at that topic, and tried some of the suggestions. The tab count was always 1 (instead of 5 I would think).
I will put more effort in my tests, though, and trying to understand what the scripts are doing. The spy was not helpful for me (in this case) and it's due to TM1 I guess, not due to the spy.
MS help websites are indeed rather poor (at least for Excel, my forte) and I tend to go to the well-known message boards rather than to MS websites.
Sometimes people are keen on gathering many posts, even if it's bullshit they're writing.
Re: Selecting a tab in another program
Hello,
Unfortunately Acc and AccViewer don't bring much progress to me in this case.
I will approach my solution as follows:
- when copying from TI to Notepad++, I use an InputBox. I type 1, 2, 3, 4 (1 = Prolog, 2 = Metadata, 3 = Data, 4 = Epilog)
- I store that information in the first line of the text file in Notepad++, as well as the Window caption of TI (to be able to copy back)
- when copying from Notepad++ to TI, I use the information in the first line to know where to paste. I do a left mouse click on the correct tab based on a relative position
After that, I will try an upgrade of the function. I cycle through the 4 tabs. If only 1 tab matches the contents of the active tab, it's fine. I know the tab name.
If 2 or more tabs match the contents of the active tab, I will use an InputBox like above.
Only remaining question for now:
Is there a way to save the text contents of a tab in a variable, without doing an explicit copy action (like sending ^a and then ^c ) and putting the clipboard in a variable ?
Thanks !
Unfortunately Acc and AccViewer don't bring much progress to me in this case.
I will approach my solution as follows:
- when copying from TI to Notepad++, I use an InputBox. I type 1, 2, 3, 4 (1 = Prolog, 2 = Metadata, 3 = Data, 4 = Epilog)
- I store that information in the first line of the text file in Notepad++, as well as the Window caption of TI (to be able to copy back)
- when copying from Notepad++ to TI, I use the information in the first line to know where to paste. I do a left mouse click on the correct tab based on a relative position
After that, I will try an upgrade of the function. I cycle through the 4 tabs. If only 1 tab matches the contents of the active tab, it's fine. I know the tab name.
If 2 or more tabs match the contents of the active tab, I will use an InputBox like above.
Only remaining question for now:
Is there a way to save the text contents of a tab in a variable, without doing an explicit copy action (like sending ^a and then ^c ) and putting the clipboard in a variable ?
Thanks !
Re: Selecting a tab in another program
You might be able to use ControlGetText depending on how Window Spy reports on the name of the control.Wigi wrote:Is there a way to save the text contents of a tab in the clipboard or a variable, without doing an explicit copy action (like sending ^a and then ^c ) ?
Re: Selecting a tab in another program
Good suggestion, I will try that !
Re: Selecting a tab in another program
@Wigi: What ClassNN does the window spy give for the tab control (e.g. SysTabControl321, SysTabControl322)? Plus thanks for your response re. the MS forums.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Selecting a tab in another program
Hi,
I was about to type what I found for the ClassNN using the window Spy:
the textbox for the Prolog is Edit1
the textbox for the Metadata is Edit2
the textbox for the Data is Edit3
the textbox for the Epilog is Edit4
So I guess I can make the distinction
I was about to type what I found for the ClassNN using the window Spy:
the textbox for the Prolog is Edit1
the textbox for the Metadata is Edit2
the textbox for the Data is Edit3
the textbox for the Epilog is Edit4
So I guess I can make the distinction
Re: Selecting a tab in another program
It looks like it's not a standard tab control.
I'd be interested in the ClassNN for 'Parameters', 'Data Source'/'Variables' etc and the text box with '#****Begin:' etc.
Try this and paste back what you've found. Note: do redact any information if preferred.
Btw if you use AccViewer(/the Acc library), there may be some information that can identify what the active tab is.
I'd be interested in the ClassNN for 'Parameters', 'Data Source'/'Variables' etc and the text box with '#****Begin:' etc.
Try this and paste back what you've found. Note: do redact any information if preferred.
Code: Select all
q::
WinGet, hWnd, ID, A
WinGet, vCtlList, ControlList, % "ahk_id " hWnd
vOutput := ""
Loop, Parse, vCtlList, `n
{
vCtlClassNN := A_LoopField
ControlGetText, vText, % vCtlClassNN, % "ahk_id " hWnd
vText := StrReplace(vText, "`r", " ")
vText := StrReplace(vText, "`n", " ")
if (StrLen(vText) > 50)
vText := SubStr(vText, 1, 50) "..."
vOutput .= RTrim(vCtlClassNN "`t" vText) "`r`n"
;vOutput .= vCtlClassNN "`t" RTrim(vText) "`r`n"
}
Clipboard := vOutput
MsgBox, % "done"
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Selecting a tab in another program
While searching for an option to prevent a manual c&p event between TI and N++ I've found this (which is off topic) but might make sense in another TI context.
So, just for the records ...
So, just for the records ...
TI Helper is an Auto Hot Key script that can be used to enhance the options in the IBM Cognos TM1 Turbo Integrator (TI) process editor. It gives short cuts and options to generate code when using the TI editor.
Found [here]
Re: Selecting a tab in another program
ClassNN for the Parameters tab is AfxWnd100u1.jeeswg wrote:I'd be interested in the ClassNN for 'Parameters', 'Data Source'/'Variables' etc and the text box with '#****Begin:' etc.
The output for your code, thanks for that, is:
Code: Select all
#327701 Turbo Integrator
#327702 Advanced
Button1 Insert Function
Button2 Goto Line...
SysTabControl321 Tab1
Static1 Parameter Grid
AfxWnd100u1
AfxWnd100u2
AfxWnd100u3
AfxWnd100u4
ScrollBar1
ScrollBar2
AfxWnd100u5
AfxWnd100u6
AfxWnd100u7
Edit1 #****Begin: Generated Statements*** #****End: Generated Statements**** tab = 'PROLOG';
Edit2 #****Begin: Generated Statements*** #****End: Generated Statements**** tab = 'METADATA';
Edit3 #****Begin: Generated Statements*** #****End: Generated Statements**** tab = 'DATA';
Edit4 #****Begin: Generated Statements*** #****End: Generated Statements**** tab = 'EPILOG';
Button3 Insert
Button4 Delete
#327703 Variables
Static2 Variables Grid
AfxWnd100u8
AfxWnd100u9
AfxWnd100u10
AfxWnd100u11
ScrollBar3
ScrollBar4
AfxWnd100u12
AfxWnd100u13
AfxWnd100u14
Button5 New Variable
Button6 Delete
#327704 Data Source
Edit5 D:\Wim\TM1\TI processes\__All files in data directory.pro
Button7 Browse...
Edit6 D:\Wim\TM1\TI processes\__All files in data directory.pro
Edit7
Edit8
Button8 &Delimited
Button9 Fi&xed Width
Button10 &Tab
Button11 &Space
Button12 Comm&a
Button13 Semico&lon
Button14 Othe&r
Edit9
Button15 Set Field Width
Edit10 "
Edit11
Edit12 ,
Edit13
Edit14
Button16 &Preview
Button17 Datasource Type
Static3 Transformer Grid Control
Button18 Log on
Button19 Signons
Button20
Static4 Source:
Edit15
Button21 Browse...
Button22 Edit...
Button23 Edit Query...
Button24 Prompts...
Button25 Preview...
Static5 Data Source Name:
Static6 Data Source Name On Server:
Static7 UserName:
Static8 Password:
Static9 Query:
Button26 Delimiter Type
Button27 Delimiter
Static10 Quote Char:
Static11 Number of title records:
Button28 Number Delimiters
Static12 Decimal Separator:
Static13 Thousand separator:
Static14 Preview
AfxWnd100u15
AfxWnd100u16
AfxWnd100u17
AfxWnd100u18
ScrollBar5
ScrollBar6
AfxWnd100u19
AfxWnd100u20
AfxWnd100u21
Static15 ODBO Cube containing dimension:
ComboBox1
Edit16
Static16 Cube Dimensions:
ComboBox2
Edit17
Static17 TM1 Dimension to load
ComboBox3
Edit18
Button29 ODBO Filter ...
Button30 TM1 Dimension Action
Button31 Create Dimension
Button32 Recreate Dimension
Button33 Update Dimension
Button34 Dont Load
SysTabControl322 Tab1
SysTabControl323 Tab1
Button35 Connect
Static18 SAP Variables Grid Will Appear Here
AfxWnd100u22
AfxWnd100u23
AfxWnd100u24
AfxWnd100u25
ScrollBar7
ScrollBar8
AfxWnd100u26
AfxWnd100u27
AfxWnd100u28
SysTabControl324 Tab1
Static19 ODBO Connection Grid
AfxWnd100u29
AfxWnd100u30
AfxWnd100u31
AfxWnd100u32
ScrollBar9
ScrollBar10
AfxWnd100u33
AfxWnd100u34
AfxWnd100u35
Edit19
Static20 Dimension Hierarchy load plan for Cube:
Static21 Sales
Static22 Load Plan Grid
AfxWnd100u36
AfxWnd100u37
AfxWnd100u38
AfxWnd100u39
ScrollBar11
ScrollBar12
AfxWnd100u40
AfxWnd100u41
AfxWnd100u42
Static23 MDX Query:
Static24 Select ODBO Cube to load From:
ComboBox4
Edit20
Static25 Select TM1 Cube to load To:
ComboBox5
Edit21
Button36 TM1 Cube Action
Button37 Create Cube
Button38 Recreate Cube
Button39 Update Cube
Button40 No Action
Button41 Data Action
Button42 Store Values
Button43 Accumulate Values
Button44 Zero Out Portion of Target Cube
Static26 View:
ComboBox6
Edit22
Button45 ...
Button46 Reload
Button47 Enable Cube Logging
Button48 Physical Cube
Button49 Virtual Cube
Button50 Cube Type
Button51 O&DBO
ComboBox7 Cube
Button52 &IBM Cognos TM1
ComboBox8 Cube View
Button53 IBM &Cognos Package
ComboBox9 Package
Button54 T&ext
Button55 &ODBC
Button56 &None
Button57 Use Unicode
Button58 &SAP
ComboBox10 InfoCube
Static27 Ruler goes here
#327705 Turbo Integrator
#327706 Connection
Static28 Transformer Grid Control
AfxWnd100u43
AfxWnd100u44
AfxWnd100u45
AfxWnd100u46
ScrollBar13
ScrollBar14
AfxWnd100u47
AfxWnd100u48
AfxWnd100u49
Button59 Signons
Button60 Log on
Button61 OK
Button62 Cancel
Button63 &Apply
Button64 Help
SysTabControl325
#327707 Turbo Integrator
#327708 Connection
Static29 SAP Grid Control
AfxWnd100u50
AfxWnd100u51
AfxWnd100u52
AfxWnd100u53
ScrollBar15
ScrollBar16
AfxWnd100u54
AfxWnd100u55
AfxWnd100u56
Button65 Connect
Button66 OK
Button67 Cancel
Button68 &Apply
Button69 Help
SysTabControl326
#327709 Schedule
Button70 Schedule this Process as a Chore Named:
Edit23 _
Button71 Chore Start Date and Time:
Static30 Date:
SysMonthCal321
Static31 Local Time:
SysDateTimePick321 18:14:07
msctls_updown321
Button72 Chore Frequency:
Edit24 0
Static32 Days
Edit25 0
Static33 Hours
Edit26 0
Static34 Minutes
Edit27 0
Static35 Seconds
Button73 Specify Parameters for Process...
Static36 Run Every:
Static37 GMT time:
Static38 2017/06/05 16:14:07
Button74 OK
Button75 Cancel
Button76 &Apply
Button77 Help
SysTabControl327
ToolbarWindow321
msctls_statusbar321 Ready
Now I will try to determine the active tab.
Re: Selecting a tab in another program
Thank you.BoBo wrote:While searching for an option to prevent a manual c&p event between TI and N++ I've found this (which is off topic) but might make sense in another TI context.
So, just for the records ...
TI Helper is an Auto Hot Key script that can be used to enhance the options in the IBM Cognos TM1 Turbo Integrator (TI) process editor. It gives short cuts and options to generate code when using the TI editor.
Found [here]
I know this tool and it helps. But it still keeps us (developers) in Turbo Integrator. I want to get away from there
Re: Selecting a tab in another program
Hi jeeswg
I'm trying AccViewer, it shows me as output all empty fields (WinTitle, ...)
How do I use the tool ?
I'm trying AccViewer, it shows me as output all empty fields (WinTitle, ...)
How do I use the tool ?
Re: Selecting a tab in another program
Click on the crosshair and drag it to a window/control/object, or use Ctrl+/.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Selecting a tab in another program
Tada, like that
Re: Selecting a tab in another program
Got the info I need in AccViewer !
Now the question, how to get the value of the "Selection" for that "SysTabControl321" into AHK ?
Now the question, how to get the value of the "Selection" for that "SysTabControl321" into AHK ?
Re: Selecting a tab in another program
Note: accSelection uses 1-based indexes, the TCM messages use 0-based indexes. (I.e. 0-based: 1st item has index 0, 1-based: 1st item has index 1.)
There are 2 messages which can get the active tab index. However, I'm not really sure if there is a difference, I suppose getting the selected item (rather than the focused item), would be safer. Realistically would the 2 ever be different, selected/focused item, is it possible to make them different via key presses and mouse clicks?
Even trying to make the focused/selected item differ, programmatically, doesn't seem to work:
Code: Select all
q:: ;tab control - get active tab index
ControlGet, hCtl, Hwnd,, SysTabControl321, A
oAcc := Acc_Get("Object", "4", 0, "ahk_id " hCtl)
MsgBox, % oAcc.accSelection
oAcc := ""
return
Code: Select all
q:: ;tab control - get active tab index
WinGet, hWnd, ID, A
SendMessage, 0x132F,,, SysTabControl321, % "ahk_id " hWnd ;TCM_GETCURFOCUS := 0x132F
vFoc := ErrorLevel+1
SendMessage, 0x130B,,, SysTabControl321, % "ahk_id " hWnd ;TCM_GETCURSEL := 0x130B
vSel := ErrorLevel+1
MsgBox, % vFoc " " vSel
return
Code: Select all
w:: ;tab control - set focused/selected tab index
WinGet, hWnd, ID, A
SendMessage, 0x130C,4,, SysTabControl321, % "ahk_id " hWnd ;TCM_SETCURSEL := 0x130C
Sleep 1000
SendMessage, 0x1330,2,, SysTabControl321, % "ahk_id " hWnd ;TCM_SETCURFOCUS := 0x1330
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Selecting a tab in another program
Wonderful, I can now read out what is the selected tab !
And I can do the same for the other tabs (Data source, variables, ...) because that is SysTabControl327 instead of SysTabControl321.
Many thanks, this was the missing piece.
I guess I will send a msgbox in case the tab of the code (in Notepad++) is not the same as the tab selected in Turbo Integrator. Then I select the correct tab manually.
This will be (at least in the beginning) better than forcing the selections (I could also send a left mouse button click to a relative position).
Just to understand it. Do I need an AHK script other than my main AHK script in which I use code similar to:
or do I need AccViewer too ? Are the 3 solutions depending on AccViewer ? I would prefer to use only my AHK script without other scripts if possible.
And I can do the same for the other tabs (Data source, variables, ...) because that is SysTabControl327 instead of SysTabControl321.
Many thanks, this was the missing piece.
I guess I will send a msgbox in case the tab of the code (in Notepad++) is not the same as the tab selected in Turbo Integrator. Then I select the correct tab manually.
This will be (at least in the beginning) better than forcing the selections (I could also send a left mouse button click to a relative position).
Just to understand it. Do I need an AHK script other than my main AHK script in which I use code similar to:
Code: Select all
q:: ;tab control - get active tab index
WinGet, hWnd, ID, A
SendMessage, 0x132F,,, SysTabControl321, % "ahk_id " hWnd ;TCM_GETCURFOCUS := 0x132F
vFoc := ErrorLevel+1
SendMessage, 0x130B,,, SysTabControl321, % "ahk_id " hWnd ;TCM_GETCURSEL := 0x130B
vSel := ErrorLevel+1
MsgBox, % vFoc " " vSel
return
Who is online
Users browsing this forum: ghoulishghoul, Google [Bot], MSN [Bot], slowwd, Xeilous and 169 guests