Jump to content

Recommended Posts

Posted

My two cents...

 

Understanding that this would add some programming to the 'haystack'... have you considered changing the 'delivery mechanism' to programmatically creating, and sending an email via Outlook to a predefined recipient list for your 'Tip of the Day'?

 

This would alleviate the issue of slowing down all users at startup, and be easily setup to 'fire' an email out to your users which they can check at their leisure.

 

Quick sample:

(Error checking not provided)

 

[font=Tahoma](defun TipOfTheDay (/ tipList tipItem outlookApp mailItem recipients)[/font]

[font=Tahoma];; tip list format: ("YYYY-MM-DD" . "Tip Message")[/font]
[font=Tahoma](setq tipList '(("2011-01-06" . [color=red]"This is a Test"[/color])[/font]
[font=Tahoma]            ("2011-01-10" . [color=#ff0000]"This is a Test"[/color])[/font]
[font=Tahoma]            ("2011-01-17" . [color=#ff0000]"This is a Test"[/color])[/font]
[font=Tahoma]            ("2011-01-24" . [color=#ff0000]"This is a Test"[/color])))[/font]

[font=Tahoma];; Main code[/font]
[font=Tahoma](if (and (setq tipItem[/font]
[font=Tahoma]              (assoc[/font]
[font=Tahoma]                (menucmd "M=$(edtime,$(getvar,date),YYYY-MO-DD)")[/font]
[font=Tahoma]                tipList))[/font]
[font=Tahoma]     (setq outlookApp[/font]
[font=Tahoma]       (vlax-get-or-create-object "Outlook.Application")))[/font]
[font=Tahoma](progn[/font]

[font=Tahoma];; Create an email[/font]
[font=Tahoma](setq mailItem (vlax-invoke outlookApp 'createitem 0))[/font]

[font=Tahoma];; Add recipients[/font]
[font=Tahoma](setq recipients (vlax-get mailItem 'recipients))[/font]
[font=Tahoma](foreach address  '([color=red]"Recipient1" "Recipient2" "Recipient3"[/color])[/font]
[font=Tahoma]  (vlax-invoke recipients 'add address))[/font]

[font=Tahoma];; Add subject line[/font]
[font=Tahoma](vlax-put-property mailItem 'subject "Tip of the Day")[/font]

[font=Tahoma];; Add body[/font]
[font=Tahoma](vlax-put-property mailItem 'body (cdr tipItem))[/font]

[font=Tahoma];; Display mailitem (for testing purposes)[/font]
[font=Tahoma];;(vlax-invoke mailItem 'display)                                                 [color=seagreen]; <- Uncomment for testing[/color][/font]

[font=Tahoma];; Send email[/font]
[font=Tahoma](vlax-invoke mailItem 'send)[/font]

[font=Tahoma];; Release external objects[/font]
[font=Tahoma](foreach x  (list outlookApp mailItem)[/font]
[font=Tahoma]  (vl-catch-all-apply 'vlax-release-object (list x)))))[/font]
[font=Tahoma](princ))[/font]

 

 

Edit: Expect issues if working with Office 2003, or older. For Office 2007 and newer this code works well.

Going one-step further, you could establish an enterprise calendar with the help of your IT department, which you could administer, and users can then subscribe to said 'Tip of the Day' calendar, which would populate their calendar (kind of like Holidays, etc.).

 

This would be more easily managed via the Outlook interface, instead of maintaining the source code for the above example... food for thought.

 

Hope this helps!

  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

  • lfe011969

    18

  • Lee Mac

    13

  • BlackBox

    7

  • ReMark

    3

Top Posters In This Topic

Posted Images

Posted
Untested and you would have to reset the list every year. I'm sure there's a better way.

 

Study my posted code in more detail :)

Posted

Perhaps for once a week:

 

(defun IWillOnlyRunOnceAWeek nil

 (alert "This is all you'll hear from me this Week")
 (princ)
)


(if
 (not
   (and
     (setq date (getenv "LMAC_OnceAWeek"))
     (< (fix (getvar 'DATE)) (atoi date))
   )
 )
 (progn
   (IWillOnlyRunOnceAWeek)
   (setenv "LMAC_OnceAWeek" (itoa (+ 7 (fix (getvar 'DATE)))))
 )
)
(princ)

Posted
Perhaps set the LISP to check the Julian Day, and store it in the registry (or elsewhere), then, should the day be the same as that stored in the registry, it won't run.

 

Re-read ^^

Posted
My two cents...

 

Understanding that this would add some programming to the 'haystack'... have you considered changing the 'delivery mechanism' to programmatically creating, and sending an email via Outlook to a predefined recipient list for your 'Tip of the Day'?

 

I would love to be able to consider using this, however for some unknown reason, our company uses Lotus Notes for email. I've been here a year and I hate it more and more every day and wish I could be using Outlook.

Posted
Re-read ^^

 

 

I don't know if it has to do with growing up in the U.S. or not but I have no idea what the Julian calendar is thus I just went with the system I know. I will look it up tomorrow.

Posted
I would love to be able to consider using this, however for some unknown reason, our company uses Lotus Notes for email. I've been here a year and I hate it more and more every day and wish I could be using Outlook.

 

That is unfortunate, however, I do believe ActiveX will work with Lotus Notes (LN) as well...?

 

Example:

 

(setq ln (vlax-get-or-create-object "Lotus Notes.Application"))

 

 

I do not have LN, so I cannot test for code revisions. If the above line of code returns something like this (see below), then we have something to work with.

 

Visual LISP Console results:

 

#<VLA-OBJECT _Application 382d4ffc> 
_$ 

 

 

Just be sure to 'release' the object when you're done, *IF* you return a non-nill.

 

(vl-catch-all-apply 'vlax-release-object (list ln))

Posted
I don't know if it has to do with growing up in the U.S. or not but I have no idea what the Julian calendar is thus I just went with the system I know. I will look it up tomorrow.

 

No worries - just read up on the DATE Sys Variable and study the two codes I posted and you'll soon see what I was hinting at :)

Posted
That is unfortunate, however, I do believe ActiveX will work with Lotus Notes (LN) as well...?

 

I will try your code out and see what happens. Thanks for the suggestion.

 

No worries - just read up on the DATE Sys Variable and study the two codes I posted and you'll soon see what I was hinting at :)

 

I should have paid more attention in History class, lol.

 

Ok, so the Julian date is a running number of days since 45 BC so today is day number 2455569.40263899 with the decimal equaling the time of day so next Monday would be 2455572 and the following Monday would be 2455579 and so forth and so on.

 

Now I'm off to see what I can come up with.

Posted
(setq ln (vlax-get-or-create-object "Lotus Notes.Application"))

 

No dice. The console returns nil for me. In addition I searched around a little on the web and didn't have much luck finding anything about sending an email through Lotus Notes. There was an old post on this board here but no one ever answered :(

Posted
No dice. The console returns nil for me. In addition I searched around a little on the web and didn't have much luck finding anything about sending an email through Lotus Notes. There was an old post on this board here but no one ever answered :(

 

I do not know your proficiency with reading VBA syntax, and writing Visual LISP syntax, but here is a sample I found doing a quick Google search:

 

Lotus Notes Send EMail from VB or VBA

 

This ORIGINAL piece of code shows you how to mail direct from VBA or VB into lotus notes. Requires Lotus Notes Client 4.5.x or later is installed on your system.

 

A semi-litmus test for the code in the above link, would be for you to try this code in lieu of my earlier snippet:

 

(setq ln (vlax-get-or-create-object "[color=blue]Notes.NotesSession[/color]"))

 

 

Again, I do not have LN, but if I can help, I'm happy to.

 

Good luck!

Posted (edited)

Also, if the snippet above for "Notes.NotesSession" *IS* successful... then this may come in handy too:

 

(defun DUMP  (arg / argType)
 (cond
   ((= 'INT (setq argType (type arg)))
    (prompt (strcat "\n>>  Integer  >>  " (itoa arg))))
   ((= 'LIST argType)
    (progn
      (prompt "\n>>  List  >>  ")
      (princ arg)))
   ((= 'REAL argType)
    (prompt (strcat "\n>>  Real  >>  " (rtos arg))))
   ((= 'STR argType)
    (prompt (strcat "\n>>  String  >>  " arg)))
   ((= 'VLA-OBJECT argType)
    (progn
      (textpage)
      (vlax-dump-object arg T)))
   (T
    (prompt "\n  <!>  Input Error: Argument Type Not Available  <!> ")))
 (princ))

Edited by BlackBox
Bad function call, replaced itoa with rtos.
Posted
I do not know your proficiency with reading VBA syntax, and writing Visual LISP syntax, but here is a sample I found doing a quick Google search:

 

Lotus Notes Send EMail from VB or VBA

 

 

 

A semi-litmus test for the code in the above link, would be for you to try this code in lieu of my earlier snippet:

 

(setq ln (vlax-get-or-create-object "[color=blue]Notes.NotesSession[/color]"))

 

 

Again, I do not have LN, but if I can help, I'm happy to.

 

Good luck!

 

Success! The console returns:

 

#<VLA-OBJECT 14c17634>

 

 

I took a Visual Basic class almost 10 years ago and wrote a couple of programs outside of the class but I haven't so much as thought of looking at any VB code in years and seeing how VBA is on its way out and .NET is the new kid in town I am hesitant to start learning the new code while I'm still learning LISP.

 

That being said, my goal has always been to get into .NET coding so I have already bookmarked the link from your post and one day in the not so distant future when I'm ready I will revisit this code and you may just get a message asking for help. Thanks!

Posted
Also, if the snippet above for "Notes.NotesSession" *IS* successful... then this may come in handy too:

 

(defun DUMP (arg / argType)
(cond
((= 'INT (setq argType (type arg)))
(prompt (strcat "\n>> Integer >> " (itoa arg))))
((= 'LIST argType)
(progn
(prompt "\n>> List >> ")
(princ arg)))
((= 'REAL argType)
(prompt (strcat "\n>> Real >> " (itoa arg))))
((= 'STR argType)
(prompt (strcat "\n>> String >> " arg)))
((= 'VLA-OBJECT argType)
(progn
(textpage)
(vlax-dump-object arg T)))
(T
(prompt "\n <!> Input Error: Argument Type Not Available <!> ")))
(princ))

 

So I've looked this code over and have figured out that it will tell you what type of input, i.e. a string, a real or an integer, was entered but I'm not sure I understand what it is for.

 

Also, I tried to pass a real number and I get the error "; error: bad argument type: fixnump: 1.33".

Posted

This was the problem:

 

(prompt (strcat "\n>> Real >> " ([color=red][b]rtos[/b][/color] arg))))

Posted
So I've looked this code over and have figured out that it will tell you what type of input, i.e. a string, a real or an integer, was entered but I'm not sure I understand what it is for.

 

[color=black](dump (setq ln (vlax-get-or-create-object "Notes.NotesSession")))[/color]

 

:wink:

 

This was the problem:

 

(prompt (strcat "\n>> Real >> " ([color=red][b]rtos[/b][/color] arg))))

 

:oops: Admittedly, I use this (the 'dump' function) for VLA-OBJECTS only... despite my trying to be prepared for anything mentality last spring, when I wrote this function. Code revised.

Posted

It didn't like that code. This is what was returned by AutoCAD:

 

Command: (dump (setq ln (vlax-get-or-create-object "Notes.NotesSession")))
; Object does not support ITypeInfo interface

Posted
It didn't like that code. This is what was returned by AutoCAD:

 

Command: (dump (setq ln (vlax-get-or-create-object "Notes.NotesSession")))
; Object does not support ITypeInfo interface

 

Curious.

 

I was hopeful that you would get somehting like this:

 

Command: (dump (setq ol (vlax-get-or-create-object "Outlook.Application")))
; _Application: nil
; Property values:
;   Application (RO) = #<VLA-OBJECT _Application 0f61b7c4>
;   Assistance (RO) = #<VLA-OBJECT IAssistance 14ffad7c>
;   Class (RO) = 0
;   COMAddIns (RO) = #<VLA-OBJECT COMAddIns 1507ff14>
;   DefaultProfileName (RO) = "Default Outlook Profile"
;   Explorers (RO) = #<VLA-OBJECT _Explorers 15080c2c>
;   Inspectors (RO) = #<VLA-OBJECT _Inspectors 1508d614>
;   IsTrusted (RO) = 0
;   LanguageSettings (RO) = #<VLA-OBJECT LanguageSettings 1508e49c>
;   Name (RO) = "Outlook"
;   Parent (RO) = nil
;   ProductCode (RO) = "{[i]RemovedByUser[/i]}"
;   Reminders (RO) = #<VLA-OBJECT _Reminders 1508e59c>
;   Session (RO) = #<VLA-OBJECT _NameSpace 1507fb3c>
;   TimeZones (RO) = #<VLA-OBJECT _TimeZones 1508d514>
;   Version (RO) = "12.0.0.6539"
; Methods supported:
;   ActiveExplorer ()
;   ActiveInspector ()
;   ActiveWindow ()
;   AdvancedSearch (4)
;   CopyFile (2)
;   CreateItem (1)
;   CreateItemFromTemplate (2)
;   CreateObject (1)
;   GetNamespace (1)
;   GetObjectReference (2)
;   IsSearchSynchronous (1)
;   Quit ()

Command: (vlax-release-object ol)
1

 

 

... Which would show you all of the properties and methods available to that VLA-OBJECT. I use this (DUMP) as a programming tool.

 

Most unfortunate.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...