Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create attachment and make task: shortcut vs copy of file

Status
Not open for further replies.

MrKovacic

IS-IT--Management
Nov 5, 2002
213
US
Hello all!

Currently, I have a working script for a help desk that asks for a ticket number, subject, and how long until it should remind you. When it attaches the ticket to the task, it attaches a shortcut, as opposed to a copy of the file. Can anyone tell me how to make it copy the file, so the files don't build up in a temp folder?

Also, any good recommendations on fixing the date side? Right now, you have to put in how many minutes to remind you, so if it is 24 hours, they have to say 1440 minutes.

Here is the current script.

(keep in mind i have altered the query boxes so it sets a value instead of asking for testing purposes)
Code:
Option Explicit
Dim objFSO, objFolder, objShell, strDirectory,WshShell,iklogname,subject,when,remedyticket,OlApp,nsNameSpace,olFolderCalendar,olEvent,olByValue
strDirectory = "c:\remtemp"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDirectory) Then
   Set objFolder = objFSO.GetFolder(strDirectory)
else
Set objFolder = objFSO.CreateFolder(strDirectory)
end if
Set WshShell = WScript.CreateObject("WScript.Shell")
iklogname = "01234567"
If iklogname = "" Then
MsgBox ("I can not create a reminder if you don't give me a ticket number.")
Wscript.Quit 1
Else
subject = "attachment test"
when = "1"
If when = "" Then
MsgBox ("This is required!")
when = Inputbox("how many minutes until I should remind you? [1440 is 24 hours]" , "Remind me in...")
Else

DIM fso, GuyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set remedyticket = fso.CreateTextFile( "C:\remtemp\RemedyTicket " & iklogname & ".ARTask", True)
remedyticket.WriteLine("[Shortcut]") 
remedyticket.WriteLine ("Name = HPD:HelpDesk") 
remedyticket.WriteLine ("Type = 0") 
remedyticket.WriteLine ("Server = my.remedy.server") 
remedyticket.WriteLine ("Join = 0") 
remedyticket.WriteLine ("Ticket = 00000000" & iklogname) 
remedyticket.Close
END IF
Set OlApp = CreateObject("Outlook.Application")
Set nsNameSpace = OlApp.GetNamespace("MAPI")
Set olFolderCalendar = nsNameSpace.GetDefaultFolder(9) 'olFolderCalendar
Set olEvent = OlApp.CreateItem(1) 'olAppointmentItem
olEvent.Start = DateAdd("n", when, Now())
olEvent.Subject = subject
olEvent.ReminderSet = True
olEvent.ReminderMinutesBeforeStart = 1
olEvent.Attachments.Add "C:\remtemp\RemedyTicket " & iklogname & ".ARTask", _
olByValue, 1, "Test"
olEvent.Save
MsgBox ("The event has been created in your Outlook calendar. Should you need to cancel or change your reminder, it must be done through outlook.")
END IF

any help would be supurb!!

Thanks in advance!!

Thank you!!!

Mike Kovacic
 
Use the following change to allow reminders in hours:

Code:
when = Inputbox("how many hours until I should remind you?" , "Remind me in...")
when = when * 60

Your users should be able to enter half and quarter hours as 1.5 or 2.25 etc.

I don't follow the requirement regarding the attachment and temp folder. Are you saying that the email only has a shortcut and not the file?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Good call on the value = value * 60
thats good ole basic stuff. I wish i knew how much of it applies to vbs.. TY!

With the second part, i have the script creating an .artask file in a temporary directory on the C: drive, and it copies a shortcut over to the TASK its creating.. the only problrm is, if that temp folder is cleared or lost, the attachment in the TASK dies too.

If I can get it to COPY instead of just COPY SHORTCUT, then the attachment is the actual file, and the temp folder can be cleared.

For example, if I set a reminder for 2 weeks, and the .artask file in the temp file gets deleted, then the shortcut attached in TASK no longer works...

Im hoping to fix that . :)

Thank you!!!

Mike Kovacic
 
I don't see where you are creating a shortcut to the file. Only reference I see is adding the attachment and that should not be a shortcut looking at the posted code.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
I agree, it should be attaching the file itself, but it creates a shortcut.. i dont understand why. :\

Thank you!!!

Mike Kovacic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top