AutoHotkey Community

It is currently May 27th, 2012, 4:16 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: February 19th, 2010, 10:15 pm 
Offline

Joined: May 22nd, 2006, 2:12 pm
Posts: 150
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 19th, 2010, 11:26 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6073
Location: San Diego, California
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 19th, 2010, 11:32 pm 
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. :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2010, 4:14 pm 
Offline

Joined: May 22nd, 2006, 2:12 pm
Posts: 150
Great Gui! I like the way it works, but why does it pick up the current time?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Mickers, rbrtryn and 70 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group