Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- LShift::Pause
- Esc::ExitApp
- ^k::Reload
- ^q::
- store_mouse_pos()
- return
- ^j::
- MsgBox, 4, , Input information?
- IfMsgBox, YES
- {
- InputBox, Program_ID, Program ID?, Input Program ID:
- InputBox, Start_Date, Start Date?, Input Start Date:
- InputBox, End_Date, End Date?, Input End Date:
- }
- main_function()
- return
- store_mouse_pos(){
- global
- CoordMode, Mouse, Screen
- MouseGetPos, loc_x, loc_y
- }
- gather_info(){
- global
- clipboard =
- Send, ^c
- Clipwait
- Program_ID = %clipboard%
- StringTrimRight, Program_ID, Program_ID, 2
- Send, {Right}
- Sleep, 50
- clipboard =
- Send, ^c
- Clipwait
- Start_Date = %clipboard%
- Send, {Right}
- Sleep, 50
- clipboard =
- Send, ^c
- Clipwait
- End_Date = %clipboard%
- Send, {Left}
- Sleep, 50
- Send, {Left}
- Sleep, 50
- }
- find_person(){
- global
- SetTitleMatchMode, 2
- clipboard =
- Send, ^c
- Clipwait
- WinActivate, Colleague
- WinWaitActive, Colleague
- Sleep, 200
- Send, ^v
- Sleep, 50
- Send, {Enter}
- Sleep, 500
- }
- find_blank(){
- global
- CoordMode, Mouse, Screen
- MouseClick, left, %loc_x%, %loc_y%,
- old_clip =
- clipboard =
- Send, ^c
- Sleep, 200
- while(clipboard != old_clip){
- test = %clipboard%
- if test = %Program_ID%
- {
- MsgBox 0,, Error: Already In
- Send, +{F8}
- Sleep, 500
- Send, {Enter}
- Sleep, 1000
- cleanup()
- Exit
- }
- old_clip = %clipboard%
- Send, {Down}
- Sleep, 100
- clipboard =
- Send, ^c
- Sleep, 200
- }
- }
- input_program(){
- global
- clipboard := Program_ID
- Send, ^v
- Sleep, 50
- Send, {Enter}
- Sleep, 1000
- Send, int
- Send, {Enter}
- Sleep, 2000
- Send, pt
- Send, {Enter}
- Sleep, 200
- Send, {Enter}
- Sleep, 200
- clipboard := Start_Date
- Send, ^v
- Sleep, 50
- Send, {Enter}
- Sleep, 200
- clipboard := End_Date
- Send, ^v
- Sleep, 50
- Send, {Enter}
- Sleep, 200
- Send, {F9}
- Sleep, 1000
- Send, {Enter}
- Sleep, 1000
- Send, {Tab}
- Sleep, 200
- Send, {Tab}
- Sleep, 200
- clipboard := Start_Date
- Send, ^v
- Sleep, 50
- Send, {Enter}
- Sleep, 200
- clipboard := End_Date
- Send, ^v
- Sleep, 50
- Send, {Enter}
- Sleep, 200
- Send, +{F9}
- Sleep, 1700
- Send, {Enter}
- }
- cleanup(){
- global
- Removed:
- WinActivate, Excel
- WinWaitActive, Excel
- Send, {Left}
- Sleep, 50
- Send, {Left}
- Sleep, 50
- Send, {Left}
- Sleep, 50
- Send, {Left}
- Sleep, 50
- Send, {Left}
- Sleep, 50
- Send, Done
- Send, {Down}
- Sleep, 50
- Send, {Right}
- Sleep, 50
- clipboard =
- Send, ^c
- Sleep, 500
- StringTrimRight, clipboard, clipboard, 2
- if clipboard !=
- {
- SetTimer, ButtonNames, 50
- MsgBox, 3, New Program?, Was this person added, removed, or new program?
- IfMsgBox, YES
- Goto, Added
- IfMsgBox, NO
- Goto, Removed
- else
- gather_info()
- }
- Added:
- Send, {Right}
- Sleep, 50
- Send, {Right}
- Sleep, 50
- Send, {Right}
- Sleep, 50
- Send, {Right}
- Sleep, 50
- Goto, EndCleanup
- ButtonNames:
- IfWinNotExist, New Program?
- return ; Keep waiting.
- SetTimer, ButtonNames, Off
- WinActivate
- ControlSetText, Button1, &Added
- ControlSetText, Button2, &Removed
- ControlSetText, Button3, &New Program
- return
- EndCleanup:
- main_function()
- }
- main_function(){
- global
- if Program_ID =
- {
- Send, {Left}
- Sleep, 50
- Send, {Left}
- Sleep, 50
- Send, {Left}
- Sleep, 50
- Send, {Left}
- Sleep, 50
- gather_info()
- Send, {Right}
- Sleep, 50
- Send, {Right}
- Sleep, 50
- Send, {Right}
- Sleep, 50
- Send, {Right}
- Sleep, 50
- }
- if loc_x =
- {
- MsgBox 0,, Error: Mouse Pos not set. Press Ctrl+Q with mouse in position to set it.
- Exit
- }
- find_person()
- find_blank()
- input_program()
- Sleep, 500
- cleanup()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement