AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COM Standard Library
Goto page Previous  1, 2, 3 ... 5, 6, 7 ... 11, 12, 13  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Wed Feb 13, 2008 4:18 pm    Post subject: Reply with quote

nnesori wrote:
but PROPERTYPUT doesn't work.

You're using the wrong object. Use GomWebCtrl.GomWeb.1 instead of GomX.GomXCtrl.1
Back to top
nnesori



Joined: 14 Oct 2006
Posts: 15
Location: south korea

PostPosted: Wed Feb 13, 2008 5:34 pm    Post subject: Reply with quote

Quote:
You're using the wrong object. Use GomWebCtrl.GomWeb.1 instead of GomX.GomXCtrl.1


The script works now.
I did not notice it. Thanks! Very Happy
By the way, How did you know that the GomX.GomXCtrl.1 is wrong object.
Back to top
View user's profile Send private message
vader
Guest





PostPosted: Wed Feb 13, 2008 9:04 pm    Post subject: Reply with quote

How can detect wmp song change.
And how can send text to messenger psm (not postmessage&controlsend)
Back to top
poetbox



Joined: 07 Jan 2007
Posts: 59

PostPosted: Sun Apr 20, 2008 3:30 am    Post subject: ObjectGet is very difficult to use Reply with quote

Can you help me to rewrite the Code such as this:
$oExcel = ObjGet("","Excel.Application")
Thank you.
The example has many Creatobject useage.While few people write code about objectget.I dunno how to Get object.
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Apr 20, 2008 4:20 am    Post subject: Re: ObjectGet is very difficult to use Reply with quote

poetbox wrote:
Can you help me to rewrite the Code such as this:
$oExcel = ObjGet("","Excel.Application")
What you want is
Code:
oExcel := COM_GetActiveObject("Excel.Application")
Back to top
Sean



Joined: 12 Feb 2007
Posts: 1338

PostPosted: Sat Jun 07, 2008 5:32 pm    Post subject: Reply with quote

Small update of COM.ahk. As users seemed to frequently forget to append suffix = to the function name in case of PropertyPut, which is understandable, added extra code which would make the scripts still work even when the suffix = is slipped off.
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Sat Jun 07, 2008 7:26 pm    Post subject: Reply with quote

Sean wrote:
Small update of COM.ahk. As users seemed to frequently forget to append suffix = to the function name in case of PropertyPut, which is understandable, added extra code which would make the scripts still work even when the suffix = is slipped off.

Thanks for that. Smile
_________________
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 679

PostPosted: Wed Jun 11, 2008 9:40 pm    Post subject: Reply with quote

http://www.autohotkey.com/forum/viewtopic.php?t=32655
Any help would be grand
_________________
Read this
Com
Automate IE7 with Tabs
Back to top
View user's profile Send private message
Azerty



Joined: 19 Dec 2006
Posts: 72
Location: France

PostPosted: Wed Jun 25, 2008 8:54 am    Post subject: Reply with quote

Nice work Sean. Thx for sharing.

2 suggestions :
- as stated before
Joy2DWorld wrote:
Sean wrote:
introduced a Global variable _hResult_ which will store the hResult of the Invoke.


while am not a big fan of the "LIBRARY"_function for truly fundamental and basic functions such as the "Invoke()", "CoInitialize()", etc.,

if we're using that structure, probably a good idea, (if this tiny suggestion is helpful) to prefix all of your global Vars with the library prefix, eg:

COM_hResult
you can even include a ghost function "Com_hResult()" which returns that global var, so those who might not understand/expect a global var, can chug smoothly along.. ALSO that way the 'item' shows up as a function in your library, so those looking to understand what they can do/get with it, can find it that way...etc.

anyhow, just a suggestion.

It would be nice to avoid globals. I like the Com_hresult() way Smile

- Introducing a COM() function which might return a version identifier for the library (either the date of last change [YYYYMMDD] for instance, or a true version if you want to follow one) would enable to reference the lib using COM() call without having to #include, would enable everyone to look for evolutions of your lib easily, and would enable AHK code shared in this forum to check if lib is in sync with code needed.

Finally, you could reference this topic's URL in a comment on first line of COM.ahk for further reference.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1338

PostPosted: Wed Jun 25, 2008 4:17 pm    Post subject: Reply with quote

Azerty wrote:
It would be nice to avoid globals. I like the Com_hresult() way Smile
I don't like global either. But, IMO it's the simplest in this case. The purpose of it is mainly for debugging, so I don't want to introduce an auxiliary function just for it. And I've never had to use it in the posted scripts so far, somewhat fortunately as it actually needs one more global, for the returned result's variant type. But, I agree the name better be changed. I like/liked the names COM_hr/COM_vt, however, I already noticed the usage of _hResult_ in some posts, so I haven't changed it.

Quote:
Introducing a COM() function which might return a version identifier for the library
Although it's a good suggestion, I think it became a bit too late/pointless to do it for now. I think the minimal implementation of COM is done now. BTW, there always exists only one COM.ahk in the forum at a given time.

Quote:
Finally, you could reference this topic's URL in a comment on first line of COM.ahk for further reference.
As a matter of fact, I kind of regretted to not have done it from the start. I may add it when updating the library. Thanks for the suggestion.
Back to top
View user's profile Send private message
Azerty



Joined: 19 Dec 2006
Posts: 72
Location: France

PostPosted: Thu Jun 26, 2008 7:17 am    Post subject: Reply with quote

Hi Sean

Sean wrote:
But, I agree the name better be changed. I like/liked the names COM_hr/COM_vt, however, I already noticed the usage of _hResult_ in some posts, so I haven't changed it.
Of course, but I think the earlier, the better. If the authors of scripts reference _hResult_ (which you mentioned is essentialy for debugging) are invited to change it (by PM for instance or by a post in their involved threads), it can be rapidly corrected before the usage becomes too wide.

Sean wrote:
I think it became a bit too late/pointless to do it for now. I think the minimal implementation of COM is done now. BTW, there always exists only one COM.ahk in the forum at a given time.
Once more, it's never too late, and it would be the occasion to deliver an officially stable version.
To my mind, the point is not about one or more versions living together, but since I don't follow regularly the forum, having this versioning helps me discover bug corrections (hopefully there a no more for now) and evolutions to the lib easily when a version id is given in the top post.

Sean wrote:
As a matter of fact, I kind of regretted to not have done it from the start. I may add it when updating the library. Thanks for the suggestion.
When adding versioning, it will be welcome. Once again, it's easier to check for updates when looking at the right post (the top most post of this topic).

Thanks for your reply anyway
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1338

PostPosted: Thu Jun 26, 2008 11:47 am    Post subject: Reply with quote

Azerty wrote:
Sean wrote:
But, I agree the name better be changed. I like/liked the names COM_hr/COM_vt, however, I already noticed the usage of _hResult_ in some posts, so I haven't changed it.
Of course, but I think the earlier, the better. If the authors of scripts reference _hResult_ (which you mentioned is essentialy for debugging) are invited to change it (by PM for instance or by a post in their involved threads), it can be rapidly corrected before the usage becomes too wide.

I realized that it could be a good opportunity for me to implement an exception handling into COM.ahk. I removed the global _hResult_ and introduced a new function
Code:
COM_Error(bDebug) ; bDebug is optional, default to False

Its default state is On, so, COM.ahk will pop-up MsgBox about the error of COM_Invoke(), and exception handling information if available, whenever an error occurs. Call COM_Error(False) to turn if off, and COM_Error(True) to turn it on again. I uploaded a new COM.ahk in the same link in the first post.

PS. I cahnged the Error Debugging default to On.


Last edited by Sean on Fri Jun 27, 2008 3:34 am; edited 1 time in total
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3626
Location: Belgrade

PostPosted: Thu Jun 26, 2008 12:27 pm    Post subject: Reply with quote

Thx dude.

Glad to know u are still alive and productive Smile
_________________
Back to top
View user's profile Send private message MSN Messenger
Sean



Joined: 12 Feb 2007
Posts: 1338

PostPosted: Thu Jun 26, 2008 2:54 pm    Post subject: Reply with quote

majkinetor wrote:
Thx dude. Glad to know u are still alive and productive Smile

Thanks and take care.
Back to top
View user's profile Send private message
CannedCheese



Joined: 22 May 2008
Posts: 64

PostPosted: Fri Jun 27, 2008 7:22 pm    Post subject: Reply with quote

Sean wrote:

PS. I cahnged the Error Debugging default to On.


Thank you for this.

I’ve been having problems with Tank’s IE7_InjectJS script on one machine (work) whereas it has worked flawlessly on another (home), both running XP Pro. Initially I thought it might have been a problem with my browser ActiveX setting, as nothing was happening on my work machine. I installed the update to the COM library today and at least now I’m getting an error message:

Function Name “ parentWindow”
ERROR: Unknown Name.
(0x80020006)

The error appears to be caused by this line:
Code:
 window:= COM_Invoke(COM_Invoke(pwb, "Document"), "parentWindow")


…. Called with…
Code:
 
F3::
list_elements2=
(
alert("This Ain't Gonna Work");
)
COM_Init()
this_page:=IE7_Get("")
msgbox this_page %this_page%
IE7_InjectJS(this_page, list_elements2)
return


here’s the complete function from Tank’s Automation Page
http://www.autohotkey.com/forum/viewtopic.php?t=30599
Code:

IE7_InjectJS(Access_Tab_Title, JS_to_Inject, VarNames_to_Return="") {
   COM_Init()
   Loop, %   COM_Invoke(psw := COM_Invoke(COM_CreateObject("Shell.Application"), "Windows"), "Count")
    {
      msgbox,,,Com Initialized, 1
      If (InStr(title:=COM_Invoke(pwb := COM_Invoke(psw, "Item", A_Index-1), "LocationName"), title, 0)) && (JS_to_Inject || VarNames_to_Return) {
         
         window:= COM_Invoke(COM_Invoke(pwb, "Document"), "parentWindow")
         msgbox Error?
         If JS_to_Inject
         COM_Invoke(window, "execScript",JS_to_Inject)
         If VarNames_to_Return {
            StringSplit, Vars_, VarNames_to_Return, `,
            Loop, %Vars_0%
               Ret .= COM_Invoke(window,Vars_%A_Index%) . ","
            StringTrimRight, Ret, Ret, 1
            }
         COM_Release(window), COM_Release(pwb) , COM_Release(Ret ), COM_Release(title)
         break
         }         
      COM_Release(title), COM_Release(pwb)
      }
   COM_Release(psw), COM_Term()
   Return Ret
   }


COM's a bit deep for me. Any ideas?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 5, 6, 7 ... 11, 12, 13  Next
Page 6 of 13

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group