AutoHotkey Community

It is currently May 26th, 2012, 8:29 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 646 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 44  Next
Author Message
 Post subject:
PostPosted: February 13th, 2008, 4:18 pm 
nnesori wrote:
but PROPERTYPUT doesn't work.

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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2008, 5:34 pm 
Offline

Joined: October 14th, 2006, 5:15 pm
Posts: 16
Location: south korea
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! :D
By the way, How did you know that the GomX.GomXCtrl.1 is wrong object.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2008, 9:04 pm 
How can detect wmp song change.
And how can send text to messenger psm (not postmessage&controlsend)


Report this post
Top
  
Reply with quote  
PostPosted: April 20th, 2008, 3:30 am 
Offline

Joined: January 7th, 2007, 1:43 pm
Posts: 107
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.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 20th, 2008, 4:20 am 
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")


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2008, 5:32 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2008, 7:26 pm 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
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. :)

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 11th, 2008, 9:40 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
http://www.autohotkey.com/forum/viewtopic.php?t=32655
Any help would be grand

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2008, 8:54 am 
Offline

Joined: December 19th, 2006, 2:14 pm
Posts: 72
Location: France
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 :)

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2008, 4:17 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Azerty wrote:
It would be nice to avoid globals. I like the Com_hresult() way :)
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2008, 7:17 am 
Offline

Joined: December 19th, 2006, 2:14 pm
Posts: 72
Location: France
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2008, 11:47 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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 June 27th, 2008, 3:34 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2008, 12:27 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Thx dude.

Glad to know u are still alive and productive :)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2008, 2:54 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
majkinetor wrote:
Thx dude. Glad to know u are still alive and productive :)

Thanks and take care.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2008, 7:22 pm 
Offline

Joined: May 22nd, 2008, 12:57 am
Posts: 120
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?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 646 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 44  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: MSN [Bot] and 18 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group