New function wishlist

Started by ....IFICantBYTE, August 21, 2013, 12:11:20 AM

Previous topic - Next topic

....IFICantBYTE

Would it be possible for the developers to please consider adding some new functions to define easier Structures for DllCalls and to Register to receive (user-definable) Windows messages (a bit like you already do with GUI event callbacks and Com/OLE events but with any windows message numbers).
The kind of functions I mean exist in other languages (but I love WinBatch) ... something like the following in AutoIt .. : http://www.autoitscript.com/autoit3/docs/functions/DllStructCreate.htm
http://www.autoitscript.com/autoit3/docs/functions/GUIRegisterMsg.htm
Here is a list of all their functions... http://www.autoitscript.com/wiki/Function_list
... there are a few other related ones... it would be GREAT if the developers could add similar functionality to WinBatch.

Also, I have been using the Postie extender and it would also be fantastic to be able to add extra functionality to the IMAP stuff... in particular the kManageImap4 function so that you could pass it more options other than just create delete or purge... basically, if you could pass user definable commands through it to your IMAP server .. things like LIST to see the folder names etc...
It would also be fantastic if we could get/set/search email messages by things like the flags set / time/date /UID etc.

Thank you.... hope some of this can happen!!! .. Please!  :)

Regards,
....IFICantBYTE

Regards,
....IFICantBYTE

Nothing sucks more than that moment during an argument when you realize you're wrong. :)

Deana

We appreciate the input. I will definitely notify the developers about these requests.
Deana F.
Technical Support
Wilson WindowWare Inc.


....IFICantBYTE

Thanks for the suggestion Deana, but I can't use that in this case, as I am talking to a proprietary VoiceMail system on a PABX .. I want to make a couple of special utilities to connect to its IMAP gateway and process certain voicemail messages and attachments in certain ways.

Regards,
....IFICantBYTE
Regards,
....IFICantBYTE

Nothing sucks more than that moment during an argument when you realize you're wrong. :)

Deana

I see. The current versions of WinBatch support .NET functionality.

Apparently MailSystem is a suite of .NET components that provide users with an extensive set of email tools. MailSystem provides full support for SMTP, POP3, IMAP4, NNTP, MIME, S/MIME, OpenPGP, DNS, vCard, vCalendar, Anti-Spam (Bayesian , RBL, DomainKeys), Queueing, Mail Merge and WhoIs.  It's free & open source.: http://mailsystem.codeplex.com/

Also the Mail.dll .NET IMAP component from Limi Labs can be used to list all folders using IMAP: http://www.limilabs.com/blog/list-all-folders-using-imap. However there is a charge for this component.
Deana F.
Technical Support
Wilson WindowWare Inc.

Deana

Here is a WinBatch dotNet example that uses the MailSystem.NET (http://mailsystem.codeplex.com/) component to list mailboxes on an IMAP server:

Code (winbatch) Select
;***************************************************************************
;**   List IMAP Mailboxes 
;**
;** Purpose:  Uses MailSystem.NET (http://mailsystem.codeplex.com/) component to  List IMAP Mailboxes
;** Inputs:  imapserver, username, password and assemblydir
;** Outputs: Mailboxes returned from Getmailbox
;** Reference:
;**       REQUIRES MailSystem.NET (http://mailsystem.codeplex.com/)
;**                WinBatch 2013A or newer
;**
;** Developer: Deana Falk 2013.08.22
;
;Use SN.EXE (Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.17929) to get Public key token
;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools>sn -T "C:\WWW\__SCRIPT LIBRARY\DotNet\Third Party\MailSystem\ActiveUp.MailSystem_May2013_Binaries\Release\ActiveUp.Net.Imap4.dll"
;Public key token is 9d424b1770e92b68
;
;***************************************************************************
If Version( )< '2013A'
   Pause('Notice', 'Need 2013A or Newer Version of WinBatch')
   Exit
EndIf

;!!! MODIFY TO FIT YOUR NEEDS !!!
imapserver = 'imap.gmail.com'
user = 'johndoe@gmail.com'
pswd = 'supersecret'
assemblydir = 'C:\WWW\__SCRIPT LIBRARY\DotNet\Third Party\MailSystem\ActiveUp.MailSystem_May2013_Binaries\Release\'

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Load assemblies into the WinBatch process.
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;AppBase: You DO NOT use the names of files containing assemblies (i.e. ActiveUp.Net.Imap4.dll)  with the 'AppBase' option.
; You Do specify the full (not partial) path to the location of the assemblies you are going to use in your script that are not in the GAC.   
; Logically this means that all non GAC assemblies need to be placed in the same directory for a given script.
ObjectClrOption('appbase',assemblydir)
ObjectClrOption ('use','ActiveUp.Net.Imap4, Version=5.0.3454.364, Culture=neutral, PublicKeyToken=9d424b1770e92b68')

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Create a class implemented by a managed assembly.
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
imap = ObjectClrNew( 'ActiveUp.Net.Mail.Imap4Client')
imap.ConnectSsl(imapserver, 993);
imap.Login(user,pswd)
;Return all children mailboxes of "inbox".
MailboxCollection = imap.GetMailboxes("inbox","*")
list = ''
cnt = MailboxCollection.Count
If cnt >0
   For x = 0 to cnt-1
       data = MailboxCollection.Item(x).Name
       if list == "" then list = data
       else list = list:@TAB:data
   Next
Else
  list = 'NO MAILBOXES FOUND'
Endif
AskItemList('Mailboxes', list, @TAB, @UNSORTED, @SINGLE )
imap.Disconnect();
Exit
Deana F.
Technical Support
Wilson WindowWare Inc.

....IFICantBYTE

Thank you VERY much for the "Mailsystem.net" link and the example of how to start using it Deana.
That is certainly worth a look at for what I want to do, and your example is a great head-start on how to load and talk to the .net assembly that is very much appreciated.
I've tried loading things outside the GAC before, but couldn't get them working.
I will see how I go with the IMAP stuff using this, but the other feature additions for WinBatch in my first post would still be desirable.

Thanks again.. you are a star.

   
Regards,
....IFICantBYTE

Nothing sucks more than that moment during an argument when you realize you're wrong. :)

DAG_P6

Quote from: ....IFICantBYTE on August 21, 2013, 12:11:20 AM
Would it be possible for the developers to please consider adding some new functions to define easier Structures for DllCalls and to Register to receive (user-definable) Windows messages (a bit like you already do with GUI event callbacks and Com/OLE events but with any windows message numbers).
The kind of functions I mean exist in other languages (but I love WinBatch)

Although I have since replaced it with a more efficient method, the original version of a WB program that I began developing last year used custom Windows messages to communicate between the main script thread and an event procedure running in another thread of a multithreaded ActiveX control. I don't recall having to do anything terribly exotic to do so.
David A. Gray
You are more important than any technology.

....IFICantBYTE

Hi David, I'm talking about being able to receive and handle Win32 Notification messages etc. directly not ActiveX or com events.
Regards,
....IFICantBYTE

Nothing sucks more than that moment during an argument when you realize you're wrong. :)

DAG_P6

Please allow me to clarify.

Quote from: ....IFICantBYTE on August 23, 2013, 05:24:28 PM
Hi David, I'm talking about being able to receive and handle Win32 Notification messages etc. directly not ActiveX or com events.

Although the event sink in question hooked a COM event, it was sending regular user-defined WM_* messages back to the main thread. When the main thread received a specific message, it knew that the other thread had finished the task on which the main thread was waiting.

As I mentioned in my original reply, I eventually replaced the custom Windows message and its listener with a global variable. Since the global variable is visible to both threads, one of which only monitors, and the other of which only changes its value, it is as effective, and more efficient. Although I haven't done so, yet, I plan to post a guard, in the form of a named mutex, now that I've figured out how easy they are to use in WinBatch scripts (no extenders required, only a few DllCalls, which reminds me of a question I need to ask.. thanks!).
David A. Gray
You are more important than any technology.

cssyphus

I second IfICantByte's request re autoIt et al.

JTaylor

I must have missed this...you have my vote too.

Jim