Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.  
  6. LShift::Pause
  7.  
  8. Esc::ExitApp
  9.  
  10. ^k::Reload
  11.  
  12. ^q::
  13.  
  14.     store_mouse_pos()
  15.  
  16. return
  17.  
  18. ^j::
  19.     MsgBox, 4, , Input information?
  20.     IfMsgBox, YES
  21.     {
  22.         InputBox, Program_ID, Program ID?, Input Program ID:
  23.         InputBox, Start_Date, Start Date?, Input Start Date:
  24.         InputBox, End_Date, End Date?, Input End Date:
  25.     }  
  26.     main_function()
  27. return
  28.  
  29. store_mouse_pos(){
  30.     global
  31.     CoordMode, Mouse, Screen
  32.     MouseGetPos, loc_x, loc_y  
  33. }
  34.  
  35. gather_info(){
  36.     global
  37.     clipboard =
  38.     Send, ^c
  39.     Clipwait
  40.     Program_ID = %clipboard%
  41.     StringTrimRight, Program_ID, Program_ID, 2
  42.     Send, {Right}
  43.     Sleep, 50
  44.     clipboard =
  45.     Send, ^c
  46.     Clipwait
  47.     Start_Date = %clipboard%
  48.     Send, {Right}
  49.     Sleep, 50  
  50.     clipboard =
  51.     Send, ^c
  52.     Clipwait
  53.     End_Date = %clipboard%
  54.     Send, {Left}
  55.     Sleep, 50
  56.     Send, {Left}
  57.     Sleep, 50
  58.  
  59. }
  60.  
  61.  
  62. find_person(){
  63.     global
  64.     SetTitleMatchMode, 2
  65.     clipboard =
  66.     Send, ^c
  67.     Clipwait
  68.     WinActivate, Colleague
  69.     WinWaitActive, Colleague
  70.     Sleep, 200
  71.     Send, ^v
  72.     Sleep, 50
  73.     Send, {Enter}
  74.     Sleep, 500
  75. }
  76.  
  77. find_blank(){
  78.     global
  79.     CoordMode, Mouse, Screen
  80.     MouseClick, left, %loc_x%, %loc_y%,
  81.     old_clip =
  82.     clipboard =
  83.     Send, ^c
  84.     Sleep, 200
  85.     while(clipboard != old_clip){
  86.         test = %clipboard%
  87.         if test = %Program_ID%
  88.         {
  89.             MsgBox 0,, Error: Already In
  90.             Send, +{F8}
  91.             Sleep, 500
  92.             Send, {Enter}
  93.             Sleep, 1000
  94.             cleanup()
  95.             Exit           
  96.         }
  97.         old_clip = %clipboard%
  98.         Send, {Down}
  99.         Sleep, 100
  100.         clipboard =
  101.         Send, ^c
  102.         Sleep, 200
  103.     }  
  104. }
  105.  
  106. input_program(){
  107.     global
  108.     clipboard := Program_ID
  109.     Send, ^v
  110.     Sleep, 50
  111.     Send, {Enter}
  112.     Sleep, 1000
  113.     Send, int
  114.     Send, {Enter}
  115.     Sleep, 2000
  116.     Send, pt
  117.     Send, {Enter}
  118.     Sleep, 200
  119.     Send, {Enter}
  120.     Sleep, 200
  121.     clipboard := Start_Date
  122.     Send, ^v
  123.     Sleep, 50
  124.     Send, {Enter}
  125.     Sleep, 200
  126.     clipboard := End_Date
  127.     Send, ^v
  128.     Sleep, 50
  129.     Send, {Enter}
  130.     Sleep, 200
  131.     Send, {F9}
  132.     Sleep, 1000
  133.     Send, {Enter}
  134.     Sleep, 1000
  135.     Send, {Tab}
  136.     Sleep, 200
  137.     Send, {Tab}
  138.     Sleep, 200
  139.     clipboard := Start_Date
  140.     Send, ^v
  141.     Sleep, 50
  142.     Send, {Enter}
  143.     Sleep, 200
  144.     clipboard := End_Date
  145.     Send, ^v
  146.     Sleep, 50
  147.     Send, {Enter}
  148.     Sleep, 200
  149.     Send, +{F9}
  150.     Sleep, 1700
  151.     Send, {Enter}  
  152. }
  153.  
  154. cleanup(){
  155.     global
  156.     Removed:
  157.     WinActivate, Excel
  158.     WinWaitActive,  Excel
  159.     Send, {Left}
  160.     Sleep, 50
  161.     Send, {Left}
  162.     Sleep, 50
  163.     Send, {Left}
  164.     Sleep, 50
  165.     Send, {Left}
  166.     Sleep, 50
  167.     Send, {Left}
  168.     Sleep, 50
  169.     Send, Done
  170.     Send, {Down}
  171.     Sleep, 50
  172.     Send, {Right}
  173.     Sleep, 50  
  174.     clipboard =
  175.     Send, ^c
  176.     Sleep, 500
  177.     StringTrimRight, clipboard, clipboard, 2
  178.     if clipboard !=  
  179.     {
  180.         SetTimer, ButtonNames, 50
  181.         MsgBox, 3, New Program?, Was this person added, removed, or new program?
  182.         IfMsgBox, YES
  183.             Goto, Added
  184.         IfMsgBox, NO
  185.             Goto, Removed
  186.         else
  187.             gather_info()
  188.     }
  189.     Added:
  190.     Send, {Right}
  191.     Sleep, 50
  192.     Send, {Right}
  193.     Sleep, 50
  194.     Send, {Right}
  195.     Sleep, 50
  196.     Send, {Right}
  197.     Sleep, 50
  198.     Goto, EndCleanup
  199.  
  200.     ButtonNames:
  201.     IfWinNotExist, New Program?
  202.         return  ; Keep waiting.
  203.     SetTimer, ButtonNames, Off
  204.     WinActivate
  205.     ControlSetText, Button1, &Added
  206.     ControlSetText, Button2, &Removed
  207.     ControlSetText, Button3, &New Program
  208.     return
  209.    
  210.     EndCleanup:
  211.     main_function()
  212. }
  213.  
  214. main_function(){
  215.     global
  216.     if Program_ID =
  217.     {
  218.         Send, {Left}
  219.         Sleep, 50
  220.         Send, {Left}
  221.         Sleep, 50
  222.         Send, {Left}
  223.         Sleep, 50
  224.         Send, {Left}
  225.         Sleep, 50
  226.         gather_info()
  227.         Send, {Right}
  228.         Sleep, 50
  229.         Send, {Right}
  230.         Sleep, 50
  231.         Send, {Right}
  232.         Sleep, 50
  233.         Send, {Right}
  234.         Sleep, 50
  235.     }
  236.     if loc_x =  
  237.     {
  238.         MsgBox 0,, Error: Mouse Pos not set. Press Ctrl+Q with mouse in position to set it.
  239.         Exit
  240.     }
  241.     find_person()
  242.     find_blank()
  243.     input_program()
  244.     Sleep, 500
  245.     cleanup()
  246.    
  247. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement