Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Where Excel71 comes from?


  • Please log in to reply
6 replies to this topic
Marcelo NS
  • Members
  • 8 posts
  • Last active: Feb 23 2013 08:29 PM
  • Joined: 24 Jan 2013

Hi i am really new here, however AHK has been really handy and friendly to use. 

I have a simple question. In the following expression:

 

 

 

ControlGet, hwnd, hwnd, , Excel71, ahk_class XLMAIN
 

 

where the Excel71 comes from? I have tried to find it out with the Windows Spy utility, a script to retrieve different values as:

 

 

 

SetTitleMatchMode, RegEx
DetectHiddenText, on
#+q::
WinGetTitle, Title, A
WinGetText, Text, A
MsgBox, The active window is "%Title%" text: "%Text%".
 

But I have no clue where this "Excel71" comes from, I would really like to now how to retrieve that value from my active window and know the value for other programs like Word, PPT, Outlook etc,

 

Thank you

 



Seidenweber
  • Moderators
  • 638 posts
  • Last active: Sep 06 2015 01:51 PM
  • Joined: 10 May 2011

Excel7 is the classname and 1 is the instance number of the control.

If there are more than one, the second ClassNN is Excel72 and so on.


All questions & answers are related to AHK 1.1.19.03 x64 Unicode

 


Marcelo NS
  • Members
  • 8 posts
  • Last active: Feb 23 2013 08:29 PM
  • Joined: 24 Jan 2013

Excel7 is the classname and 1 is the instance number of the control.

If there are more than one, the second ClassNN is Excel72 and so on.

Thank you. 

I should have explained a bit more what i was trying to do. 

The class Excel7X shows up only when the workbooks are "windowed" when i maximize the work book the class changes to XLDESK1. 

 

For some reason the function " Acc_ObjectFromWindow " only send the right scrolling signal if I use Excel71 hardcoded in my script. However if I try to gather the ClassNN the script only works if i have the "windowed"  workbooks.

Here is my code, any hint about what could be wrong?

 

 

;Define Matching Method
SetTitleMatchMode, RegEx

;For MS Office
#IfWinActive ahk_class (OpusApp|XLMAIN|PPT)
WheelLeft:: 
WheelRight:: 
	Acc_ObjectFromWindow(ActiveWinClassNN(), -16).SmallScroll(0,0,InStr(A_ThisHotkey,"Left")? -1:1)
return
#IfWinActive

ActiveWinClassNN() 
{
	MouseGetPos, , , id, class, 2
	return class
}


jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009

You already answered you question - even though you don't realize it:

The class Excel7X shows up only when the workbooks are "windowed" when i maximize the work book the class changes to XLDESK1.

 

Don't confuse showing up with existing. Also, the control doesn't change - but what control you are accessing via MouseGetPos may change. Regardless, you still need to get the HWND of the Excel7X control to use with Acc_ObjectFromWindow. The forefront/maximized Excel7 control will always be the first instance.



Marcelo NS
  • Members
  • 8 posts
  • Last active: Feb 23 2013 08:29 PM
  • Joined: 24 Jan 2013

You already answered you question - even though you don't realize it:

 

Don't confuse showing up with existing. Also, the control doesn't change - but what control you are accessing via MouseGetPos may change. Regardless, you still need to get the HWND of the Excel7X control to use with Acc_ObjectFromWindow. The forefront/maximized Excel7 control will always be the first instance.

 

Thank you. It becomes clearer now. Which command can i use in order to retrieve the forefront/maxed control instead of?

ActiveWinClassNN() 
{
	MouseGetPos, , , id, class, 2
	return class
}


jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009

For some reason the function " Acc_ObjectFromWindow " only send the right scrolling signal if I use Excel71 hardcoded in my script. 

 

The forefront/maximized Excel7 control will always be the first instance. Excel7 is the control class - and you want the 1st instance. Hence Excel71.



Marcelo NS
  • Members
  • 8 posts
  • Last active: Feb 23 2013 08:29 PM
  • Joined: 24 Jan 2013

The forefront/maximized Excel7 control will always be the first instance. Excel7 is the control class - and you want the 1st instance. Hence Excel71.

 

It is clear jethrow, the poster (me) has a hard brick in place of a brain happy.png . You can close this topic and mark the question as being responded (it was in fact at least 3 times...)