TMXOD Posted March 2, 2008 Posted March 2, 2008 I started work on a Email-to-Fax gateway powered by Mozilla Thunderbird+Attachment Extractor, PDFCreator, and AutoIt. The general flow of the program is as following:(Client side)User types in destination fax numberUser types in destination nameuser types the file whose contents are to be faxeduser types in notification email addressFile is converted to PDF using PDFCreator using the following constraints (to allow for weird files, like CAD drawings or propietary image formats, which the server may not be able to decode): Color: GrayscalePaper Size: LetterResolution 200dpifax descriptor file is created file name to faxdestination namedestination numbernotification email addressinstallation-unique confirmation code (avoid spam)fax descriptor and PDF files are attached to an email message containing a specially-crafted subject (avoid accidentally sending spam through fax)message is sent using MAPI(server side, when a message is received)if the message has the specific subject, continue; else abortextract attached PDF and fax descriptor from received emailread information from file descriptor, abort if confirmation code invalidfax is sent using local COM Objectuser is emailed when fax is sent or an error occursI'm having problems with the actual sending of the fax. I'm going from what I found at this page. The VBScript works, when adapted to my test, but what I think is an accurate translation to AutoIt does not. The code is:Dim $faxServer = ObjCreate("FAXCOMEX.FaxServer") If @error <> 1 And IsObj($faxServer) Then $faxServer.Connect ("") Dim $faxDoc = ObjCreate("FAXCOMEX.FaxDocument") If @error <> 1 And IsObj($faxDoc) Then With $faxDoc .Body = @ScriptFullPath .DocumentName=@ScriptName & " source" .Recipients.Add("5555555555") ; hiding actual destination phone number .Sender.Email="root@localhost.com" ; hiding actual email address .Sender.Name="ME" ; hiding actual name .Sender.FaxNumber="5555555555" ; hiding actual home phone number EndWith $faxServer.Folders.OutgoingQueue.Branding=False $faxServer.Folders.OutgoingQueue.Save() Dim $jobid=$faxdoc.ConnectedSubmit($faxServer) ;<--AHK ConsoleWrite("Finished -- JOB ID: " & $jobid & @CRLF) EndIf EndIfThe error occurs in line 16 (the one marked as "<--AHK"). The error message is "The requested action with this object has failed." I think the problem is how I'm passing one object as the parameter to ConnectedSubmit. Am I doing this right? or do I need to do this differently?
Oldschool Posted March 2, 2008 Posted March 2, 2008 I'd try taking all the Dims out of there and see if that helps...
PsaltyDS Posted March 3, 2008 Posted March 3, 2008 I started work on a Email-to-Fax gateway powered by Mozilla Thunderbird+Attachment Extractor, PDFCreator, and AutoIt. The general flow of the program is as following:(Client side)User types in destination fax numberUser types in destination nameuser types the file whose contents are to be faxeduser types in notification email addressFile is converted to PDF using PDFCreator using the following constraints (to allow for weird files, like CAD drawings or propietary image formats, which the server may not be able to decode):Color: GrayscalePaper Size: LetterResolution 200dpifax descriptor file is createdfile name to faxdestination namedestination numbernotification email addressinstallation-unique confirmation code (avoid spam)fax descriptor and PDF files are attached to an email message containing a specially-crafted subject (avoid accidentally sending spam through fax)message is sent using MAPI(server side, when a message is received)if the message has the specific subject, continue; else abortextract attached PDF and fax descriptor from received emailread information from file descriptor, abort if confirmation code invalidfax is sent using local COM Objectuser is emailed when fax is sent or an error occursI'm having problems with the actual sending of the fax. I'm going from what I found at this page. The VBScript works, when adapted to my test, but what I think is an accurate translation to AutoIt does not. The code is:Dim $faxServer = ObjCreate("FAXCOMEX.FaxServer") If @error <> 1 And IsObj($faxServer) Then $faxServer.Connect ("") Dim $faxDoc = ObjCreate("FAXCOMEX.FaxDocument") If @error <> 1 And IsObj($faxDoc) Then With $faxDoc .Body = @ScriptFullPath .DocumentName=@ScriptName & " source" .Recipients.Add("5555555555") ; hiding actual destination phone number .Sender.Email="root@localhost.com" ; hiding actual email address .Sender.Name="ME" ; hiding actual name .Sender.FaxNumber="5555555555" ; hiding actual home phone number EndWith $faxServer.Folders.OutgoingQueue.Branding=False $faxServer.Folders.OutgoingQueue.Save() Dim $jobid=$faxdoc.ConnectedSubmit($faxServer) ;<--AHK ConsoleWrite("Finished -- JOB ID: " & $jobid & @CRLF) EndIf EndIfThe error occurs in line 16 (the one marked as "<--AHK"). The error message is "The requested action with this object has failed." I think the problem is how I'm passing one object as the parameter to ConnectedSubmit. Am I doing this right? or do I need to do this differently?It looks straight to me. The DIM's are irrelevant (I would prefer just declaring GLOBAL's at the top, but that's just preference). Add a COM Error handler as under the OBJ/COM Reference section of the help file. That will get you more detail on the error. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
DaleHohm Posted March 3, 2008 Posted March 3, 2008 You may also want to look for a working example in another language (like VBScript) to use as a template. If you have such a thing you can also post it here for reference. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
PsaltyDS Posted March 3, 2008 Posted March 3, 2008 (edited) You may also want to look for a working example in another language (like VBScript) to use as a template. If you have such a thing you can also post it here for reference.DaleI think he did. I've never used that object so I Googled "FAXCOMEX.FaxServer" and compared his AutoIt code to the VBScript examples that showed up. I can't see any problem with his translation just by visual inspection. Edited March 3, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
DaleHohm Posted March 3, 2008 Posted March 3, 2008 Ah, of course... I missed that link. How about adding a COM error handeler to see if you can get more info from the erro object? An easy way to do this is to add this to your code: #include <IE.au3> _IEErrorHandlerRegister() Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
PsaltyDS Posted March 16, 2009 Posted March 16, 2009 I'm having the same problem. Any solution yet?We never got an answer from the OP after asking him (twice!) to try it with a COM error handler to get more details. Did you try that? What results did you get? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
BinaryBrother Posted March 20, 2009 Posted March 20, 2009 I'm not sure this is how it works... but I attached the error handler, and it spat out... Number is: 80020009 Windescription is: No application is associated with the specified file for this operation. Of course if it could be done from a per-user basis, like mine... I would assume you guys would have already done that. Since I'm usually wrong, I'd also assume this is a 'personal' user-based error... I don't have the app that works with that Object... If I was no help, I was bored and gave it a shot, please don't yell... If that helped, +1 to boredom... SIGNATURE_0X800007D NOT FOUND
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now