AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Time Accounting System Help Please

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
john tuomi



Joined: 22 May 2006
Posts: 150

PostPosted: Fri Feb 19, 2010 9:15 pm    Post subject: Time Accounting System Help Please Reply with quote

I am trying to write universal script to use to input time records for my employees. I currently use a script that enters a set schedule into our oracle based system. The issue I have with it is that if I have employees with different schedules, I have to include a different sub-script to fill out those times.

What I'd like to do is have it recognize the employee name from the screen, and compare it to an IF..Then scenario, and enter the proper time for those employees.

The first part of the script is a compromise, as window spy does not see the employee name or id, even though it is visible on the screen. I can highlight and cut and paste the name, though, so I figured I could have it on the clipboard or as a variable from there.

I'm not sure though how to make it work. Any ideas?

One other thing that would be helpful is if I could specify if there was a holiday during the week. For example, if I number the days of the week ( 1-5), I could tell the script not to fill out that day.

Here's the script so far, I know it probably won't work as is. Any help would be appreciated.

Code:
f2::
clipboard :=name
Mousemove,210,204
click down
MouseMove, 300,0, 30,r
send,^c
Click up,l

if name=joe blow
{
Send,7a{tab}12{tab}12:30p{tab}3:30p{tab 7}
Send,7a{tab}12{tab}12:30p{tab}3:30p{tab 7}
Send,7a{tab}12{tab}12:30p{tab}3:30p{tab 7}
Send,7a{tab}12{tab}12:30p{tab}3:30p{tab 7}
Send,7a{tab}12{tab}12:30p{tab}3:30p{tab 7}
}
else
{
Send,9a{tab}11:30a{tab}12p{tab}5:00p{tab 7}
Send,9a{tab}11:30a{tab}12p{tab}5:00p{tab 7}
Send,9a{tab}11:30a{tab}12p{tab}5:00p{tab 7}
Send,9a{tab}11:30a{tab}12p{tab}5:00p{tab 7}
Send,9a{tab}11:30a{tab}12p{tab}5:00p{tab 7}
}
return
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 5334
Location: San Diego, California

PostPosted: Fri Feb 19, 2010 10:26 pm    Post subject: Reply with quote

Hi john,

I'm not familiar with Oracle database programs but maybe I can help.
Here is a script that displays the window info and contol info under the mouse cursor.
Theoretically, if you placed it over the employee's name, it should show you details about that control as a tooltip.
If you hit F1 the same info is copied to the clipboard.

If this works, it is rather straight-forward to modify your script to get the name with Ahk commands.

Please try out the script and see it it properly detects employee names.

Code:
#Persistent

SetTimer, WatchCursor, 100
Gosub, WatchCursor  ; Call it once to get it started right away.
return


WatchCursor:
text=
; get info about the current mouse location, specifically window info and control info
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
ControlGetText, text , %control%, ahk_id %id%


; show info about the current mouse location
tooltip, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control% `ntext: %text%
return

esc::exitapp   ; in case of emergency, hit escape

f1::         ; copy info about the current mouse location to the clipboard
Gosub, WatchCursor 
clipboard= ahk_id %id%`r`nahk_class %class%`r`n%title%`r`nControl: %control%`r`ntext: >>>`r`n%text%
return
Back to top
View user's profile Send private message
Murx
Guest





PostPosted: Fri Feb 19, 2010 10:32 pm    Post subject: Reply with quote

Code:
#SingleInstance, Force

Employees := "Jon Doe||Homer Simpson|Barach Obama|Murx"
Sort, Employees,

Gui, Add, DropDownList, x10 y14 w184 vEmployee, % Employees
Gui, Add, Checkbox, xp yp+26 w60 h24 vCB1 gSetTime Checked, MON
Gui, Add, Checkbox, xp yp+26 wp hp vCB2 gSetTime Checked, TUE
Gui, Add, Checkbox, xp yp+26 wp hp vCB3 gSetTime Checked, WED
Gui, Add, Checkbox, xp yp+26 wp hp vCB4 gSetTime Checked, THU
Gui, Add, Checkbox, xp yp+26 wp hp vCB5 gSetTime Checked, FRI
Gui, Add, DateTime, xp+60 yp-104 w60 h24 vBDT1, HH:mm
Gui, Add, DateTime, xp+64 yp wp hp vEDT1, HH:mm
Gui, Add, DateTime, xp-64 yp+24 wp hp vBDT2, HH:mm
Gui, Add, DateTime, xp+64 yp wp hp vEDT2, HH:mm
Gui, Add, DateTime, xp-64 yp+24 wp hp vBDT3, HH:mm
Gui, Add, DateTime, xp+64 yp wp hp vEDT3, HH:mm
Gui, Add, DateTime, xp-64 yp+24 wp hp vBDT4, HH:mm
Gui, Add, DateTime, xp+64 yp wp hp vEDT4, HH:mm
Gui, Add, DateTime, xp-64 yp+24 wp hp vBDT5, HH:mm
Gui, Add, DateTime, xp+64 yp wp hp vEDT5, HH:mm
Gui, Show,, MyTAS
Return

SetTime:
Gui, Submit, NoHide
Loop, 5 {
   Status := CB%A_Index% = 0 ? "Disable":"Enable"
       GuiControl, %Status%, BDT%A_Index%
       GuiControl, %Status%, EDT%A_Index%
       }
Return
a gui which can give you a starting point to simplify the input of those data. Smile
Back to top
john tuomi



Joined: 22 May 2006
Posts: 150

PostPosted: Tue Feb 23, 2010 3:14 pm    Post subject: Reply with quote

Great Gui! I like the way it works, but why does it pick up the current time?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group