AutoHotkey Community

It is currently May 25th, 2012, 2:46 am

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 156 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 11  Next
Author Message
 Post subject:
PostPosted: February 15th, 2007, 5:26 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Laszlo wrote:
Especially in this case, when it is faster, simpler, safer to use explicit offsets, like *(ptr+1).

Safer?, I agree. Faster?, I don't know. Simpler?, I disagree.
I chose ++ptr not because I didn't know *(ptr+1) is safer. I did it just because ++ptr looked simpler and elegant, at least symbolically. So, I won't change it unless it's broken. Of course you can change it as whatever you like.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2007, 11:59 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
foom wrote:
I like it that you create wrappers around the dll calls but please name the functions the same as the wrapped functions. Having to remember 2 different names for 1 function is a PITA. It would be much better if you could read on msdn and start typing the functions names out as they apear on msdn rather than have to look what the wrapper function is called in your lib.

I understand. But I'm doubtful how many users would take the trouble to go to MSDN before using the helper functions.
They may ask: what kind of name are these, MultiByteToWideChar and WideCharToMultiByte? They really don't mean much. So, I chose Ansi2Unicode etc, even if they are ambiguous: Ansi, it's not only ANSI, it can be OEM, or even MAC codepages or UTF-7 or UTF-8. And UTF-16 is not the only Unicode encoding. However, it would convey the actual purpose of the function more clearly. (As you probably guessed already, 2 for To, 4 for From here) BTW, I was tempted to use Ansi2Wide etc, but I decided not.

Regarding CreateObject and GetObject, as a matter of fact, I hesitated a little between them and CoCreateObject (:not CoCreateInstance) and CoGetObject. The reason was that I was afraid of that it could lead name collisions when AHK implements COM fully. AHK would want to use the names after VB like I did. But, after surveying the naming conventions of AHK, I concluded it's rather unlikely. It's likely to use the names like ObjCreate and ObjGet as AutoIt did. So, I took the names from VBS.

Anyway, if you have better names, please let me know.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2007, 7:15 pm 
Offline

Joined: April 19th, 2006, 1:02 pm
Posts: 386
If you are afraid of nameclashes use a decent prefix. COM_ ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2007, 1:26 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Laszlo wrote:
If you say that the current evaluation order should be the rule, try to convince Chris to document it and promise that it will not change (very often).
There is an item in the pre-release test battery to prevent evaluation order from changing. If it ever does change, I intend to log it in the changelog.

I think I mentioned this in some other topic, but maybe it got lost in the shuffle.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2007, 2:24 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
Chris wrote:
There is an item in the pre-release test battery to prevent evaluation order from changing
Why not add a sentence to the Help, saying that all operands are evaluated, except in short-circuit logic expressions, and in left-to-right order (next to "Operators of equal precedence such as multiply (*) and divide (/) are evaluated in left-to-right order unless otherwise specified"). It looks like many scripts posted to the Forum rely on it. (People don't seem to be taught any more about good programming styles.) This little change in the documentation would make those scripts valid (but still of bad style).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2007, 3:19 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
foom wrote:
If you are afraid of nameclashes use a decent prefix. COM_ ?

I'd like to do it, that's also majkinetor suggested to do. But, there is a problem. What about Ansi2Unicode or Unicode2Ansi? Should they be prefixed with either COM_ or API_?
Actually Unicode2Ansi in CoHelper.ahk used to be secialized to be used in COM only: it was designed to receive only a pointer to the unicode string, not a variable for a string. So, it should be prefixed by COM_.
But, now I've changed it to receive both a pointer and a variable as ByRef (:there is still a chance to go wrong, for example, if the unicode string starts with U+3939 U+3939 U+0030...). So, should it be now prefixed with API_?

What about DecodeInteger and EncodeInteger?

Any suggestion?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2007, 6:32 am 
So what's the deal on the COM naming conventions?

Will these names hold, when COM is introduced into AHK?

Speaking of which, this whole AHK and COM is smoking hot, so when/what release will AHK offically go COM???

Also, if I had a vote, I would go with the JScript naming conventions for COM/OLE. This way, you do not copy AutoIt, but have naming conventions that are recognized.

AutoHotkey is not "in line" with Visual Basic and VBScript programming style. So JScript type names may be better for AutoHotkey. AutoHotkey and JScript, are more in line with C "programming style".


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2007, 6:39 am 
Oppsss... Jscript language reference, to see what names they used.

http://msdn2.microsoft.com/en-us/library/hbxc2t98.aspx


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2007, 6:50 am 
You can also download both JScript's Help CHM and VBScript's Help CHM from

http://download.microsoft.com/download/ ... ptHelp.msi


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 26th, 2007, 7:12 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
So that more people find out about this topic, I've linked to it from the DllCall page. Its "related" section now reads: "Component Object Model (COM): It is possible to use COM via DllCall. There is a series of helper functions at http://www.autohotkey.com/forum/topic16631.html.

Sean, I hope you don't mind, but I also added a link in the topmost post here that points to one of your topics that uses COM Helper. Feel free to revise it as you see fit.

Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 26th, 2007, 11:49 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Chris wrote:
Sean, I hope you don't mind, but I also added a link in the topmost post here that points to one of your topics that uses COM Helper. Feel free to revise it as you see fit.

Of course not. Thanks for adding the link.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 27th, 2007, 8:07 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
2 Chris
I beleive that it is much better to add wiki section where I collected almost all important things done with COM including this one, in a much more organised way, including examples where appropriate. On the wiki are also references to the forum

http://www.autohotkey.com/wiki/index.ph ... M_Wrappers

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 27th, 2007, 12:47 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Thanks; I've updated the DllCall page to use that link.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 2nd, 2007, 3:00 pm 
Offline

Joined: September 24th, 2004, 3:00 pm
Posts: 814
Location: Germany
How can I translate this JS-Code to AHK?

Code:
var iTunesApp = WScript.CreateObject("iTunes.Application");
            iTunesApp.Play();
            iTunesApp.NextTrack();

_________________
Tekl


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 2nd, 2007, 3:42 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
I don't have a iTunes.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 156 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 11 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