I've created a script which automates my work greatly. The main function of it is sending out email to users.
This is the code:
Code: Select all
SetTitleMatchMode, 2
!b::
SendInput, ^c ; Copy the whole text which would be parsed later
Sleep, 500 ; Waits for 500 ms
ReadFullName := "Full Name+" ; Reads the line "Full Name+" from the clipboard and save it in ReadFullName variable
ReadTicketID := "Ticket ID+" ; Reads the line "Ticket ID+" from the clipboard and save it in ReadTicketID variable
ReadSummary := "Summary" ; Reads the line "Summary" from the clipboard and save it in ReadSummary variable
Status := 0 ; Initialize Status variable to 0
Loop, Parse, Clipboard, `n, `r ; Reads the Clipboard
{
if Status ; If Status variable is 1, read that line and save it in a variable (ReadFullName variable)
{
Name := A_LoopField
Status := 0
break
}
else if InStr(A_LoopField, ReadFullName)
Status := 1
}
Loop, Parse, Clipboard, `n, `r
{
if Status ; If Status variable is 1, read that line and save it in a variable (ReadTicketID variable)
{
Ticket := A_LoopField
Status := 0
break
}
else if InStr(A_LoopField, ReadTicketID)
Status := 1
}
Loop, Parse, Clipboard, `n, `r
{
if Status ; If Status variable is 1, read that line and save it in a variable (ReadSummary variable)
{
Summary := A_LoopField
Status := 0
break
}
else if InStr(A_LoopField, ReadSummary)
Status := 1
}
; The below command does these things:
; - Activate Outlook - Untitled Message Window
; - Perform hotkey commands to navigate around the email's body and paste the copied variables to their respective places
WinActivate, Untitled - Message
SendInput, ^{Home}{End}^+{Left}%Ticket%{Down}{Left}^+{Left}%Name%{Down 2}^{Left}^+{Right}%Ticket%{Space}^{Right}^+{Right}%Summary%^{Home}{Down}+{Up}^x+{Tab}^v
return
Code: Select all
Current mode: ModifyHide toolbar
Save New search New search New request New request Searches My Reports Advanced search Clear Status history Logout Home
Ticket ID+
USIM100234567989
Resolve Before
1/22/2018 5:00:00 PM
Editor for Resolve BeforeStatus
Work In Progress
Arrival Time
1/19/2018 3:29:17 AM
Editor for Arrival TimeSubmitted By
me
708
Current Site
FIELD BASED
Menu for Current SiteProfileLocation
FIELDLOCATION
Special:
WIN7
Editor for Special:Notes
Site/ExtBusiness Unit:
BUSINESSUNIT
2050
Telephone
+1800123456789
ExternalLogin Name+
LOGINNAME
Full Name+
AUTOHOTKEY USER
General
Asset Info
Requester Info
Similar Cases
RTPA/Pandora
History Info
Assignment
Detail
Ticket History
Case Type
Incident
CBS HelpPriority
High
Source
Phone
Summary
AUTOHOTKEY - SCRIPTING HELP
Menu for SummaryEditor for SummaryDescription
- User wants help in scripting AUTOHOTKEY
Editor for DescriptionCode Lookup+
LOOKUP
Type+
STANDARD APPS
Menu for Type+Category+
CATEGORY
Menu for Category+Sub Code+
CODE
Menu for Sub Code+Group+
GROUP
Menu for Group+Individual+
INDIVIDUAL
Menu for Individual++FindDesc.Show AllSubmitter Grp
Menu for Submitter GrpCreate Problem Mgmt EntrySearch Existing Problems
It's all working fine and dandy, but I would like to ask if the code can be somewhat improved in a way?
Thank you!