KRG-23

MyScript

Sep 3rd, 2018
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv
  2. #SingleInstance,Force
  3.  
  4.  
  5. ; #Warn
  6.  
  7. ; ===============================================
  8. ; ===============================================
  9. ; Vars
  10. ; ===============================================
  11. ; ===============================================
  12.  
  13. OnMessage(0x201,"Check_Control")
  14. OnMessage(0x200, "WM_MOUSEMOVE")
  15. temp_Last_Name_Edit:="Last Name*",
  16. temp_First_Name_Edit:="First Name*",
  17. temp_Disturbance_App:="App*"
  18. temp_Disturbance_Title:="Title*"
  19. temp_Disturbance_Affected_App:="Affected App or Service*"
  20. temp_Disturbance_Affected_Business:="Affected Business*"
  21. temp_Disturbance_Affected_Market:="Affected Markets*"
  22. temp_Disturbance_Next_Info:="Next Information*"
  23. Unchanged_Last:=1,
  24. Unchanged_First:=1
  25. Unchanged_App:=1
  26. Unchanged_Title:=1
  27. Unchanged_Affected_App:=1
  28. Unchanged_Affected_Business:=1
  29. Unchanged_Affected_Market:=1
  30. Unchanged_Next_Info:=1
  31. Font_Options:="cRed Q5",
  32. Font_Type:="Verdana",
  33. SetFontOptions:="Q5",
  34. SetFontType:="Verdana"
  35. Last_Name_Edit_TT := "Enter your lastname."
  36. First_Name_Edit_TT := "Enter your firstname."
  37. Inline_TT := "Opens INLINE Disturbance channel."
  38. Disturbance_App_TT := "Fill in the name of the application or service."
  39. Disturbance_Title_TT := "Fill in the title of the disturbance (no timestamp)."
  40. Disturbance_Content_TT := "Fill in the description of the disturbance."
  41. Disturbance_Affected_App_TT := "What is the affected application or service?"
  42. Disturbance_Affected_Business_TT := "What is the affected business?"
  43. Disturbance_Affected_Market_TT := "What is the affected market?"
  44. Disturbance_Next_Info_TT := "When will be the next update?"
  45. Create_New_Disturbance_TT := "Opens INLINE disturbance creation form."
  46. Send_SMS_TT := "Opens an email with the above information already filled in."
  47. Reset_TT := "Reload the tool."
  48. ; Icon:="C:\Windows\System32\wmploc.DLL, 12"
  49. Icon_App:= % A_ScriptDir . "\images\wmploc_474.ico"
  50.  
  51. ; ===============================================
  52. ; ===============================================
  53. ; Gui
  54. ; ===============================================
  55. ; ===============================================
  56.  
  57.  
  58. ; GUI settings
  59. ; ===============================================
  60. SysGet, marea, Monitor
  61. wfactor= 6 ;Customize to adjust the horizontal position based on OS edition and style
  62. Width= 320
  63. Height= 580
  64. Xpos := (marearight-Width-wfactor)
  65. Ypos := 0
  66.  
  67. ; Disturbance_Message := "`n`n`nADDITIONAL INFORMATION:`nAffected services/applications:`nAffected business process:`nAffected markets:`nNext information:`n`nFor more information contact your local IT Service Desk."
  68. WinID := "Create message - Scania InLine - Internet Explorer ahk_class IEFrame ahk_exe IEXPLORE.EXE"
  69.  
  70.  
  71. ; GUI generation
  72. ; ===============================================
  73.     Gui,1: Margin,, 10
  74.     Gui,1: Default
  75.     Gui,1: +Caption +Border -AlwaysOnTop
  76.     Gui,1: Color, cFFFFFF
  77.     Gui,1: Font, Normal, Verdana
  78.     Gui,1: Add, Tab3,, Main|Keyboard shortcuts
  79.     Gui,1: Tab, Keyboard shortcuts,
  80.     Gui,1: Add, Text, xm+10 ym+30 w260,Here's a list of the keyboard shortcuts and keyphrases that I use to ease my busy IMC life.`nExemple of use: writing sms_sig will trigger the action to type in your personal information when writing a SMS email.
  81.     Gui,1: Add, Text, Section, ALT + A:
  82.     Gui,1: Add, Text, ys w260, Insert timestamp and carrier return.
  83.     Gui,1: Add, Text, Section xm+10 y+10, ===:
  84.     Gui,1: Add, Text, ys w260, Insert a line full of = signs (50).
  85.     Gui,1: Add, Text, Section xm+10 y+10, sms_sig:
  86.     Gui,1: Add, Text, ys w260, Writes your personal information when writing a SMS email.
  87.     Gui,1: Tab, Main,
  88.     Gui,1: Add, GroupBox, Section xm+10 ym+30  h45 w280, Who are you?
  89.     Gui,1: Font,% Font_Options ,% Font_Type
  90.     Gui,1: Add, Edit, Section xs+10 ys+15 w125 r1 vLast_Name_Edit gSubmit_All, % temp_Last_Name_Edit
  91.     Gui,1: Add, Edit, ys w125 r1 vFirst_Name_Edit gSubmit_All, % temp_First_Name_Edit
  92.     Gui,1: Font,
  93.     Gui,1: Font, Normal ,Verdana
  94.     Gui,1: Add, GroupBox, xm+10 y+25 Section h450 w280, Inline disturbances
  95.     Gui,1: Add, Button, xs+10 ys+20 Uppercase h25 vInline gOpen_Inline, &Check INLINE
  96.     Gui,1: Font,% Font_Options ,% Font_Type
  97.     Gui,1: Add, Edit, Section xm+20 y+20 w125 r1 Uppercase vDisturbance_App gSubmit_All, % temp_Disturbance_App
  98.     Gui,1: Add, Edit, ys w125 r1 vDisturbance_Title gSubmit_All, % temp_Disturbance_Title
  99.     Gui,1: Add, Edit, xm+20 y+20 w260 r5 vDisturbance_Content gSubmit_All, Content*
  100.     Gui,1: Add, Edit, xm+20 y+20 w260 r1 vDisturbance_Affected_App gSubmit_All, % temp_Disturbance_Affected_App
  101.     Gui,1: Add, Edit, xm+20 y+20 w260 r1 vDisturbance_Affected_Business gSubmit_All, % temp_Disturbance_Affected_Business
  102.     Gui,1: Add, Edit, xm+20 y+20 w260 r1 vDisturbance_Affected_Market gSubmit_All, % temp_Disturbance_Affected_Market
  103.     Gui,1: Add, Edit, xm+20 y+20 w260 r1 vDisturbance_Next_Info gSubmit_All, % temp_Disturbance_Next_Info
  104.     Gui,1: Font,
  105.     Gui,1: Font, Normal ,Verdana
  106.     Gui,1: Add, Button, Section xm+20 y+10 h25 gCreate_New_Disturbance, Create a New disturbance
  107.     Gui,1: Add, Button, ys h25 gSend_SMS, Send SMS
  108.     Gui,1: Add, Button, Section xm+20 y+30 h25 vReset gButt_Reset, &Reset  
  109.     Gui,1: Add, Button, ys hp gGuiClose, Exit
  110.     Gui,1: Show, w%Width% h%Height% x%Xpos% y%Ypos%, IMC Survival kit
  111.     Menu, tray, Icon , %Icon_App%, 1, 1
  112. Return
  113.  
  114.  
  115.  
  116. ; ===============================================  
  117. ; ===============================================  
  118. ;Labels/actions
  119. ; ===============================================
  120. ; ===============================================
  121.  
  122. ; Empty Gui
  123. ; ===============================================
  124. Butt_Reset:
  125.     Reload
  126.     Return
  127.  
  128. ; Close button action
  129. ; ===============================================
  130. GuiClose:
  131.     ExitApp
  132. Return
  133.  
  134. ; Send SMS button action
  135. ; ===============================================
  136.  
  137.  
  138. Submit_All:
  139.     Gui,1: Submit, NoHide
  140. Return
  141.  
  142.  
  143.  
  144.  
  145. Open_Inline:
  146.     Gui,1: Submit, NoHide
  147.     ; Run iexplore.exe, https://inline.scania.com/scripts/cgiip.exe/WService=inline/cm/pub/showdoc.p?docid=577&showchannelid=4019
  148.     wb := ComObjCreate("InternetExplorer.Application")
  149.     wb.Visible := true
  150.     wb.Navigate("https://inline.scania.com/scripts/cgiip.exe/WService=inline/cm/pub/showdoc.p?docid=577&showchannelid=4019")
  151. Return
  152.  
  153. Create_New_Disturbance:
  154.     Gui,1: Submit, NoHide
  155.     ; MsgBox, %Mon1Left% & %Mon1Left% and %Xmouse% - %Ymouse%
  156.     ; SysGet, Mon2, Monitor, 2
  157.     ; Xmouse := %Mon2Left%//2
  158.     ; Ymouse := %Mon2Bottom%//2
  159.     ; MsgBox, Left: %Mon2Left% -- Top: %Mon2Top% -- Right: %Mon2Right% -- Bottom %Mon2Bottom% -- %Xmouse% %Ymouse%.
  160.     ; MouseMove, Xmouse, Ymouse, 0
  161.     Gui,2: Add, Text, cRed Bold s48, Locking your mouse while sending data to webpage.
  162.     Gui,2: Show, x0 y0 Autosize, Please wait ...
  163.     BlockInput MouseMove
  164.     If !WinExist(WinID)
  165.     {
  166.         wb := ComObjCreate("InternetExplorer.Application")
  167.         wb.Visible := true
  168.         wb.Navigate("https://inline.scania.com/scripts/cgiip.exe/WService=inline/cm/pub/showdoc.p?docid=598&channeltypeId=3&channelid=4019")
  169.     }  
  170.     Else
  171.     {
  172.     WinActivate
  173.     }
  174.     Gosub Insert_New_Disturbance
  175. Return
  176.  
  177. Insert_New_Disturbance:
  178. ; Sleep 8000
  179. Countdown()
  180. FormatTime, time, A_now, dd/MM/yyyy HH:mm tt
  181. SendInput,
  182. (
  183. %time% CEST. NEW DISTURBANCE:{space}%Disturbance_App%: %Disturbance_Title%
  184. {tab}{i}{tab}%Disturbance_Content%
  185. )
  186. Tooltip,
  187. fn_Tab_Loop(11)
  188. SendInput, Scania IT IM
  189. fn_Tab_Loop(1)
  190. SendInput, im.scania_it@scania.com
  191. BlockInput MouseMoveOff
  192. Gui,2: Destroy
  193. Return
  194.  
  195. Send_SMS:
  196.     Gui,1: Submit, NoHide
  197.     Email_Body := % time . " CEST. NEW DISTURBANCE: " . Disturbance_App . ": " . Disturbance_Title . ". " . Disturbance_Content . " \\" . First_Name_Edit . " " . Last_Name_Edit . ", Scania Incident Management."
  198.     Run, mailto:dl0210@scania.com?body=%Email_Body%
  199.     Sleep 1000
  200.     MsgBox, 0x30, Warning, Don't forget to change the FROM field / sender email address.
  201. Return
  202.  
  203. ; ===============================================  
  204. ; ===============================================  
  205. ;Functions
  206. ; ===============================================
  207. ; ===============================================
  208.  
  209. ; Countdown
  210. ; ===============================================
  211. Countdown()
  212. {
  213. Loop 8
  214. {
  215. ToolTip, % "Sending data in: " . 9 - A_Index ; if you just use A_Index it starts at 1 2 3 etc
  216. Sleep 1000
  217. }
  218. Tooltip, 0
  219. }
  220.  
  221. ; Tab nav
  222. ; ===============================================
  223. fn_Tab_Loop(x)
  224.     {
  225.     Counter := 0
  226.     Loop
  227.         {
  228.         Counter++
  229.         SendInput, {Tab}
  230.         Sleep, 200
  231.         if (Counter = x)
  232.         Break
  233.         }
  234.     Return
  235.     }
  236.    
  237.  
  238. WM_MOUSEMOVE()
  239. {
  240.     static CurrControl, PrevControl, _TT  ; _TT is kept blank for use by the ToolTip command below.
  241.     CurrControl := A_GuiControl
  242.     If (CurrControl <> PrevControl and not InStr(CurrControl, " "))
  243.     {
  244.         ToolTip  ; Turn off any previous tooltip.
  245.         SetTimer, DisplayToolTip, 500
  246.         PrevControl := CurrControl
  247.     }
  248.     return
  249.  
  250.     DisplayToolTip:
  251.    SetTimer, DisplayToolTip, Off
  252.     ToolTip % %CurrControl%_TT  ; The leading percent sign tell it to use an expression.
  253.     SetTimer, RemoveToolTip, 3000
  254.     return
  255.  
  256.     RemoveToolTip:
  257.    SetTimer, RemoveToolTip, Off
  258.     ToolTip
  259.     return
  260. }  
  261.    
  262.    
  263.    
  264. Check_Control(){
  265.     global
  266.     if(A_GuiControl="Last_Name_Edit"&&Unchanged_Last=1)
  267.         PromptFunction("Last_Name_Edit",Unchanged_Last,SetFontOptions,SetFontType,"1")
  268.     else if(Unchanged_Last=0&&Last_Name_Edit=null)
  269.         PromptFunction("Last_Name_Edit",Unchanged_Last,Font_Options,Font_Type,"1",temp_Last_Name_Edit)
  270.     if(A_GuiControl="First_Name_Edit"&&Unchanged_First=1)
  271.         PromptFunction("First_Name_Edit",Unchanged_First,SetFontOptions,SetFontType,"1")
  272.     else if(Unchanged_First=0&&First_Name_Edit=null)
  273.         PromptFunction("First_Name_Edit",Unchanged_First,Font_Options,Font_Type,"1",temp_First_Name_Edit)
  274.     if(A_GuiControl="Disturbance_App"&&Unchanged_App=1)
  275.         PromptFunction("Disturbance_App",Unchanged_App,SetFontOptions,SetFontType,"1")
  276.     else if(Unchanged_App=0&&Disturbance_App=null)
  277.         PromptFunction("Disturbance_App",Unchanged_App,Font_Options,Font_Type,"1",temp_Disturbance_App)
  278.     if(A_GuiControl="Disturbance_Title"&&Unchanged_Title=1)
  279.         PromptFunction("Disturbance_Title",Unchanged_Title,SetFontOptions,SetFontType,"1")
  280.     else if(Unchanged_App=0&&Disturbance_Title=null)
  281.         PromptFunction("Disturbance_Title",Unchanged_Title,Font_Options,Font_Type,"1",temp_Disturbance_Title)
  282.     if(A_GuiControl="Disturbance_Affected_App"&&Unchanged_Affected_App=1)
  283.         PromptFunction("Disturbance_Affected_App",Unchanged_Affected_App,SetFontOptions,SetFontType,"1")
  284.     else if(Unchanged_Affected_App=0&&Disturbance_Affected_App=null)
  285.         PromptFunction("Disturbance_Affected_App",Unchanged_Affected_App,Font_Options,Font_Type,"1",temp_Disturbance_Affected_Business)
  286.     if(A_GuiControl="Disturbance_Affected_Business"&&Unchanged_Affected_Business=1)
  287.         PromptFunction("Disturbance_Affected_Business",Unchanged_Affected_Business,SetFontOptions,SetFontType,"1")
  288.     else if(Unchanged_Affected_Business=0&&Disturbance_Affected_Business=null)
  289.         PromptFunction("Disturbance_Affected_Business",Unchanged_Affected_Business,Font_Options,Font_Type,"1",temp_Disturbance_Affected_Business)
  290.     if(A_GuiControl="Disturbance_Affected_Market"&&Unchanged_Affected_Market=1)
  291.         PromptFunction("Disturbance_Affected_Market",Unchanged_Affected_Market,SetFontOptions,SetFontType,"1")
  292.     else if(Unchanged_Affected_Market=0&&Disturbance_Affected_Market=null)
  293.         PromptFunction("Disturbance_Affected_Market",Unchanged_Affected_Market,Font_Options,Font_Type,"1",temp_Disturbance_Affected_Market)
  294.     if(A_GuiControl="Disturbance_Next_Info"&&Unchanged_Next_Info=1)
  295.         PromptFunction("Disturbance_Next_Info",Unchanged_Next_Info,SetFontOptions,SetFontType,"1")
  296.     else if(Unchanged_Next_Info=0&&Disturbance_Next_Info=null)
  297.         PromptFunction("Disturbance_Next_Info",Unchanged_Next_Info,Font_Options,Font_Type,"1",temp_Disturbance_Next_Info)  
  298.        
  299. }
  300. PromptFunction(ByRef TargetEdit,ByRef State,FOptions,FType,GuiName,TempText:="" ){
  301.     State:=!State
  302.     GuiControl,%GuiName%:,%TargetEdit%,% TempText
  303.     Gui,%GuiName%:Font,
  304.     Gui,%GuiName%:Font,% FOptions ,% FType
  305.     GuiControl,%GuiName%:Font,%TargetEdit%
  306. }  
  307.    
  308.    
  309.    
  310. ; ===============================================  
  311. ; ===============================================  
  312. ;Hotkeys
  313. ; ===============================================
  314. ; ===============================================
  315.  
  316. f11::listvars
  317.  
  318. ::sms_sig::
  319. SendInput, // %First_Name_Edit% %Last_Name_Edit%, Incident Manager, Scania CV AB
  320. Return
  321.  
  322. ::===::
  323. SendInput, ===============================================
  324. Return
  325.  
  326. ::new_disturbance::
  327. FormatTime, time, A_now, dd/MM/yyyy HH:mm tt
  328. SendInput,
  329. (
  330. %time% CEST. NEW DISTURBANCE:{space}
  331. {tab}{tab}{enter}
  332. ADDITIONAL INFORMATION:{enter}
  333. Affected services/applications:{space}
  334. Affected business process:{space}
  335. Affected markets:{space}
  336. Next information:{space}{enter}
  337. For more information contact your local IT Service Desk.
  338. )
  339. Return
  340.  
  341. !a::
  342. FormatTime, time, A_now, dd/MM/yyyy HH:mm tt
  343. sendInput, %time%{enter}
  344. return
  345.  
  346.  
  347. ~Tab::
  348.     sleep,50
  349.     ControlGetFocus,temp2,A,
  350.     GuiControlGet,temp3,1:Name,%temp2%
  351.     if(temp3="Last_Name_Edit"&&Unchanged_Last=1)
  352.         PromptFunction("Last_Name_Edit",Unchanged_Last,SetFontOptions,SetFontType,"1")
  353.     else if(Unchanged_Last=0&&Last_Name_Edit=null)
  354.         PromptFunction("Last_Name_Edit",Unchanged_Last,Font_Options,Font_Type,"1",temp_Last_Name_Edit)
  355.     if(temp3="First_Name_Edit"&&Unchanged_First=1)
  356.         PromptFunction("First_Name_Edit",Unchanged_First,SetFontOptions,SetFontType,"1")
  357.     else if(Unchanged_First=0&&First_Name_Edit=null)
  358.         PromptFunction("First_Name_Edit",Unchanged_First,Font_Options,Font_Type,"1",temp_First_Name_Edit)
  359.     if(temp3="Disturbance_App"&&Unchanged_App=1)
  360.         PromptFunction("Disturbance_App",Unchanged_App,SetFontOptions,SetFontType,"1")
  361.     else if(Unchanged_App=0&&Disturbance_App=null)
  362.         PromptFunction("Disturbance_App",Unchanged_App,Font_Options,Font_Type,"1",temp_Disturbance_App)
  363.     if(temp3="Disturbance_Title"&&Unchanged_Title=1)
  364.         PromptFunction("Disturbance_Title",Unchanged_Title,SetFontOptions,SetFontType,"1")
  365.     else if(Unchanged_Title=0&&Disturbance_Title=null)
  366.         PromptFunction("Disturbance_Title",Unchanged_Title,Font_Options,Font_Type,"1",temp_Disturbance_Title)
  367.     if(temp3="Disturbance_Affected_App"&&Unchanged_Affected_App=1)
  368.         PromptFunction("Disturbance_Affected_App",Unchanged_Affected_App,SetFontOptions,SetFontType,"1")
  369.     else if(Unchanged_Affected_App=0&&Disturbance_Affected_App=null)
  370.         PromptFunction("Disturbance_Affected_App",Unchanged_Affected_App,Font_Options,Font_Type,"1",temp_Unchanged_Affected_App)
  371.     if(temp3="Disturbance_Affected_Business"&&Unchanged_Affected_Business=1)
  372.         PromptFunction("Disturbance_Affected_Business",Unchanged_Affected_Business,SetFontOptions,SetFontType,"1")
  373.     else if(Unchanged_Affected_Business=0&&Disturbance_Affected_Business=null)
  374.         PromptFunction("Disturbance_Affected_Business",Unchanged_Affected_Business,Font_Options,Font_Type,"1",temp_Unchanged_Affected_Business)
  375.     if(temp3="Disturbance_Affected_Market"&&Unchanged_Affected_Market=1)
  376.         PromptFunction("Disturbance_Affected_Market",Unchanged_Affected_Market,SetFontOptions,SetFontType,"1")
  377.     else if(Unchanged_Affected_Market=0&&Disturbance_Affected_Market=null)
  378.         PromptFunction("Disturbance_Affected_Market",Unchanged_Affected_Market,Font_Options,Font_Type,"1",temp_Unchanged_Affected_Market)  
  379.     if(temp3="Disturbance_Next_Info"&&Unchanged_Next_Info=1)
  380.         PromptFunction("Disturbance_Next_Info",Unchanged_Next_Info,SetFontOptions,SetFontType,"1")
  381.     else if(Unchanged_Next_Info=0&&Disturbance_Next_Info=null)
  382.         PromptFunction("Disturbance_Next_Info",Unchanged_Next_Info,Font_Options,Font_Type,"1",temp_Unchanged_Next_Info)
  383.     return
  384.  
  385.  
  386.  
  387. ::Soder::
  388. ::soder::
  389. SendInput, Södertälje
  390. Return
  391.  
  392. ::tack::
  393. SendInput, Tack för din hjälp
  394. Return
  395.  
  396. ::ops ehd::
  397. SendInput, OPS EHD Service Desk Scania Angers{Tab}{Enter}
  398. Return
  399.  
  400. ::de_rien::
  401. SendInput, Varsågod
  402. Return
Add Comment
Please, Sign In to add comment