AutoHotkey Community

It is currently May 27th, 2012, 6:21 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 44 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: December 4th, 2010, 6:37 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
Gauss wrote:
...I wonder why Sean didn't post it on the first page of the original one!


Probably because we had no way to anticipate that AHK_L would suddenly become the de facto version of AHK. Since at the time the original version was still the standard there wasn't a lot of point to pushing solutions to an alternate version to the top of the stack (an exception being COM).

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2010, 3:03 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Quote:
I wonder why Sean didn't post it on the first page of the original one!
IMO, threads like this one should be trivial/pointless. Otherwise, there would've been no point of implementing Native COM.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2010, 6:14 am 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
Sean wrote:
Quote:
I wonder why Sean didn't post it on the first page of the original one!
IMO, threads like this one should be trivial/pointless. Otherwise, there would've been no point of implementing Native COM.


I would like to very humbly mention here that experts/programmers who know Objects/COM may find it very trivial. But noobs like me with no programming/engineering background rely on examples. And without any working examples on how to use native COM, it is pretty useless to me.
So I created a thread so that new members of the AHK community are not confused when they try to run scripts on the forum and keep on getting error messages. It is important more so now, becuase AHK_L is the first download option presented to new entrants, and many of the advanced scripts on this forum wont run on AHK_L.

Also, though completely off topic, i would like to mention here that though i joined on 15 Sep 2006, i have not asked many questions on Ask for help all these years. Most of whatever I have learnt in AHK was through studying the Documents (so well written), the examples on the forum, rarely the Wiki. Hence thanks to all active members like Sean and countless others who have created a huge database of useful functions and scripts.
Hence I feel i should do my bit to help any other newbie non-programmer who happens to stumble upon AHK. If this thread is trivial, mods may delete it, as simple as that.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2010, 8:28 am 
Offline

Joined: August 25th, 2009, 4:52 pm
Posts: 321
shajul wrote:
I would like to very humbly mention here that experts/programmers who know Objects/COM may find it very trivial. But noobs like me with no programming/engineering background rely on examples. And without any working examples on how to use native COM, it is pretty useless to me.
+1 Thanks shajul. Your examples are very helpful to me and I'm sure for other non-advanced users too.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2010, 11:25 am 
Quote:
IMO, threads like this one should be trivial/pointless. Otherwise, there would've been no point of implementing Native COM.


I totally disagree. Being Guru doesn't mean your always right, not everyone on the forum is professional programmer, most are noobs.
And some Gurus here realize that (Like SKAN), they try to make things as clear and easy to understand/access as possible. And they don't mind speaking noobs languages once in a while.
However, other gurus seem to demand extra respect and bigger brains of those who want to use their work. And don't even like it when others try to simplify things around.
If you were so concerned about this "Email Delivery" then you would have fixed it on the first page of the original post, I'm not going to browse 11+ pages looking for a version that works
or and update, that's not professional, so be thankful that someone fixed it in a new thread.

Relax dude.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2010, 12:00 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
shajul wrote:
I would like to very humbly mention here that experts/programmers who know Objects/COM may find it very trivial.
It was not a critique on your thread, but was my answer to the quest.

Quote:
But noobs like me with no programming/engineering background rely on examples. And without any working examples on how to use native COM, it is pretty useless to me.
That's why I said that Native COM implementation would've been pointless. Why do you think other people were so obsessed with the dot syntax support for COM? Then, countless codes in VBS/JS abundant all over the web were supposed to be example codes, after obvious/trivial adjusts into AHK. Anyway, what count are the contents the codes contain, not the syntax in which they are written. IMO, you better spend your time in digging into/out new contents than in converting mere syntax (which I don't think deserves a new thread).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2010, 2:46 pm 
I have tried to run this using AHK_L but does not work.

Line 30 is "field,value in fields"

and this is the error msg:

D:\1\atest.ahk (30) : ==> This line does not contain a recognized action.
Specifically: For field,value in fields

Any ideas why this does not work?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2010, 3:06 pm 
Offline

Joined: June 17th, 2008, 7:51 am
Posts: 243
I think, you've got the wrong version of AHK_L. Download the actual one.

_________________
Greetings
Rog


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2010, 5:01 pm 
Thanks ruespe for repling

Tried Basic, first

I downloaded the latest version. (from the forums Download page)
Installed both ANSI, no luck, then installed the Unicode version (both 32 bit)

But still have the same error.

So I do not think that is the problem, unliess I do not understand
"Download the actual one" means.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2010, 6:49 pm 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
Sean wrote:
IMO, you better spend your time in digging into/out new contents than in converting mere syntax..


I hope List Running Processes [AHK_L], WMI Tasks COM with AHK_L, Create a scheduled task natively [AHK_L] and Powerpoint.application qualify.
CDO email delivery was the first one i used, hence posted it in a new thread so that it was prominent for AHK_L users, with full credits to you. Thanks again for your code. Maybe we can append the posts here to the main thread when we have more powerful moderation features of PHPBB3 8)


New AHK experimenter wrote:
But still have the same error.

Steps to get it right:
    1. Uninstall current version of Autohotkey
    2. Open task manager and "End Process" any Autohotkey.exe process
    3. Download and Install Autohotkey_L from here -> Downloads
    4. Choose Unicode when prompted.
    5. Save the following code as test.ahk and run it
    Code:
    isUnicode := A_IsUnicode ? "Yes" : "No"
    MsgBox % "Autohotkey Version : " . A_AhkVersion . "`nAutohotkey Path : " . A_AhkPath . "`nIs Unicode : " . isUnicode


    It should say something like
    Quote:
    Autohotkey Version : 1.0.90.00
    Autohotkey Path : C:\Program Files\AutoHotkey\AutoHotkey.exe
    Is Unicode : Yes


Then you can try to run the CDO Email code again. Also, you may want to see Autohotkey_L and Basic Together


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2010, 1:49 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
shajul wrote:
I hope List Running Processes [AHK_L], WMI Tasks COM with AHK_L, Create a scheduled task natively [AHK_L] and Powerpoint.application qualify.
CDO email delivery was the first one i used, hence posted it in a new thread so that it was prominent for AHK_L users, with full credits to you.
Good. BTW, if you're interested in a real challenge on Email subject, here is one: although I haven't encountered one so far, there is a possibility that some smtp server accepts only 587 port for Explicit SSL. As CDOSYS doesn't handle 587 port for Explicit SSL, there may remain only one COM solution: using .NET's System.Net.Mail. So, write a COM code for it. If you like a pure COM challenge, here is another one: write a COM code for 465 port for Implicit SSL using System.Web.Mail, which will be a little more involved.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Now with MAPI...
PostPosted: December 6th, 2010, 6:25 pm 
Offline

Joined: February 22nd, 2009, 7:24 pm
Posts: 21
Location: Dallas TX
Absolutely great work guys!

I have had a need over the last week or so to hook an Outlook box to send messages. I'm still working on it but I figured I'd post what I have so far as I tore the forums apart looking for something like it. Parts are based on the CDO.message functions and most of the rest was modified from the Outlook developer site here:
http://msdn.microsoft.com/en-us/library/ff861252.aspx

I'm still working on CC and BCC and MAPI uses some kind of crazy account struct for the from field, so... yeah. But the attachments work and it resolves the "to" address before sending and alerts you if it won't resolve.

DEPENDENCIES:
This script requires that Outlook or another MAPI based mail client be installed

It is written in AHK_L COM compliant syntax

TEST ENVIRONMENT:
Built and tested in Windows XP X64 sp3 with a gmail account. Written with SciTE4AHK


Code:
object.FromAddress := "noreply@gmail.com"
ToAddress := "noreply@gmail.com"
MessageSubject := "MAPI TEST"
MessageBody := "This is a test of the MAPI hooked batch sender"
AttachmentPath := "c:\TEST.txt|c:\OTHER_TEST.ico" ; can add multiple attachments, the delimiter is |

ol := ComObjCreate("Outlook.Application")
ns := ol.getNamespace("MAPI")
ns.logon("","",true,false) ;get default MAPI profile
newMail := ol.CreateItem(0) ;0 is Outlook constant 'olMailItem' (thanks Sinkfaze)
newMail.Subject := MessageSubject
newMail.Body := MessageBody
MessageAttach := newMail.Attachments
Loop, Parse, AttachmentPath, |, %A_Space%%A_Tab%
MessageAttach.Add(A_LoopField)

; validate the recipient, just in case...
myRecipient := ns.CreateRecipient(ToAddress)
myRecipient.Resolve
If Not myRecipient.Resolved
MsgBox "unknown recipient"
Else
{
newMail.Recipients.Add(myRecipient)
;newMail.Sender := FromAddress ;this would be the from field but does not work yet
newMail.Send
MsgBox mail sent!
}
Return


Improvements are welcome!

_________________
"lol, i made this thing, but it didn't work... so I read the forums and now it does!"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2010, 9:22 pm 
yes, yes, yes

At last, although a little dismayed at the steps, but it finally worked.
This will teach me for future use.


thx to shajul


Report this post
Top
  
Reply with quote  
 Post subject: Re: Now with MAPI...
PostPosted: December 7th, 2010, 7:26 am 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
The Naked General wrote:
DEPENDENCIES:
This script requires that Outlook or another MAPI based mail client be installed

It is written in AHK_L COM compliant syntax

TEST ENVIRONMENT:
Built and tested in Windows XP X64 sp3 with a gmail account. Written with SciTE4AHK

Your documentation is wonderful, covers all aspects, something for us to imitate.


The Naked General wrote:
Code:
object.FromAddress := "noreply@gmail.com"
...
;newMail.Sender := FromAddress ;this would be the from field but does not work yet


The reason the from field does not work maybe because the from field need not be an object, eg (this works for me)
Code:
FromAddress := "noreply@gmail.com"
...
newMail.Sender := FromAddress



The Naked General wrote:
Code:
ns.logon("","",true,false) ;get default MAPI profile

This may be changed to
Code:
ns.logon("Outlook","",true,true) ;get default MAPI profile

as that is the default profile created by Outlook.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 9th, 2010, 6:55 am 
Offline

Joined: February 22nd, 2009, 7:24 pm
Posts: 21
Location: Dallas TX
Yeah I tried it like you said above not referencing it as a object and it throws an error.

Tested on two machines now with same error.

Error: 0x80020006 - Unknown name.

Specifically: Sender

025: newMail.Sender := FromAddress

_________________
"lol, i made this thing, but it didn't work... so I read the forums and now it does!"


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 44 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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