Instead of requiring appointments that are to run applications to be categorized, we could have the script check the subject of the appointment. If it started with, for example, “[Run]” we could have extracted the text that follows and hand that to the WSH shell.Here in the world of Gearhead over the last two weeks we’ve looked at bending Outlook to our will so we could launch external applications when Outlook reminder events were triggered from calendar appointment items.So, by golly, last week we did it! In just a few lines of code we added the facility we were after by capturing the reminder event in a Visual Basic for Applications script that checked to see if the appointment was categorized as “RunApp.” If it was, the script extracted the command to execute from the appointment body and handed it to a Windows Script Host (WSH) shell. Voilà! But how could we improve on this?Well, instead of requiring appointments that are to run applications to be categorized, we could have the script check the subject of the appointment. If it started with, for example, “[Run]” we could have extracted the text that follows and hand that to the WSH shell. Here’s last week’s code transmogrified into one subroutine and modified to do the above. So, if you tried last week’s code, delete the function RunApp and replace the Application_Reminder code with the following:Private Sub Application_Reminder(ByVal Item As Object) Dim Runstr As StringDim WSHShellIf (TypeOf Item Is AppointmentItem) And _(Left(Item.Subject, 5)=”[Run]”) _ThenItem.ReminderSet=False Item.Close(False)Runstr=Trim(Right(Item.Subject,Len(Item.Subject)-4))Set WSHShell=CreateObject(“wscript.Shell”)WSHShell.Run Runstr, 1, False Set WSHShell=NothingEnd IfEnd SubNote the underscores at the end of some of the lines; these let a statement span multiple lines. Also there is no underscore after “Then” – this defines the lines down to the “End if” as an “if block.” Without that the first line after “Then” would be assumed to be the end of the “If . . . then . . . ” code.An alternative would be to run the external scheduled applications from task list items rather than from calendar items. The only real difference would be to use the following test for TaskItem in place of the AppointmentItem test:If (TypeOf Item Is TaskItem) And _And of course you could allow scheduled programs to be defined by either type of item:If ((TypeOf Item Is AppointmentItem) Or _(TypeOf Item Is TaskItem)) And _That’s not too bad, but now that we’ve used this for a while we keep forgetting to set the reminder flag when we define an appointment or task item. Worse still, even when we do and we use appointments, we often forget to set the “remind beforehand” value to “0,” which makes the reminder happen before the event’s target time! Ugly.The answer, our friend, is blowin’ in a form: Yep, you can create a custom form that fills in just the specific values for a task or appointment item. You could even create a drop-down list of predefined applications as a separate control and then, using VBScript in the form, set the subject value of the item. We will leave that as an exercise for the reader.Another thing: If you want the external application to be launched silently you’ll have to set the third parameter of the call to WSHShell.Run to 7, thus:WSHShell.Run Runstr, 7, FalseSee the Microsoft Developer’s Network Library for the ghastly details.There are, however, some ugly bits to this. First, there is the issue we discussed last week of reminders not calling the reminder event handler until about 40 seconds after the scheduled event. Ugh.Then there is a really ugly problem when a reminder event happens. Even though you theoretically have grabbed it in the code above and cleared the reminder flag, if you have enabled reminder popups the popup window will appear. It won’t have anything new in it, mind you, as you did clear the reminder from the item! Yuck.So, there’s lots of room for improvement and polishing. If you have any code you’d like to share, let us know.Reminders to gearhead@gibbs.com. Related content how-to Doing tricks on the Linux command line Linux tricks can make even the more complicated Linux commands easier, more fun and more rewarding. By Sandra Henry-Stocker Dec 08, 2023 5 mins Linux news TSMC bets on AI chips for revival of growth in semiconductor demand Executives at the chip manufacturer are still optimistic about the revenue potential of AI, as Nvidia and its partners say new GPUs have a lead time of up to 52 weeks. By Sam Reynolds Dec 08, 2023 3 mins CPUs and Processors Technology Industry news End of road for VMware’s end-user computing and security units: Broadcom Broadcom is refocusing VMWare on creating private and hybrid cloud environments for large enterprises and divesting its non-core assets. By Sam Reynolds Dec 08, 2023 3 mins Mergers and Acquisitions news analysis IBM cloud service aims to deliver secure, multicloud connectivity IBM Hybrid Cloud Mesh is a multicloud networking service that includes IT discovery, security, monitoring and traffic-engineering capabilities. By Michael Cooney Dec 07, 2023 3 mins Network Security Network Security Network Security Podcasts Videos Resources Events NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe