divanebaba wrote: As I know, as a beginner like you, you love
Plug&Play solutions.
BoBo wrote:... Let's guess you're more than happy now to support him/her. ...
I'm more than drunken now.
Yes I'm a beginner but don't want others to write cods for me i only want help when i'm stuck and have no idea which direction to go i have write all the codes below and when i cant find the solution for my problems i come to ASK FOR HELP.
Auto start script - to run my time tracker
-----------------------------------------------------------
#NoTrayIcon
#SingleInstance force
#Persistent
DetectHiddenWindows, On
SetTitleMatchMode, RegEx
SetTimer, Check, 60000 ;check every one min
return
Check:
IfWinNotExist, Timetrack.ahk
IfWinNotExist, search and run script.ahk
IfWinNotExist, Changepass.ahk
IfWinNotExist, ^30\d{4}\.ahk
Run,search and run script.ahk
return
^!e::
sleep 500
send ^!q
sleep 500
send ^!q
sleep 500
Run,search and run script.ahk
return
_____________________________________________________
search and run script - to find the employeeID of a employee
-----------------------------------------------------------------------------
#SingleInstance force
Gui +LastFound +OwnDialogs +AlwaysOnTop
TempVar := A_ScreenHeight +100
path:="D:\Network Drive\Timetracker"
ext:="ahk"
Gui,Show, h%TempVar% w%A_ScreenWidth%
;//InputBox, OutputVar[, Title, Prompt , HIDE, Width, Height, X , Y, Font, Timeout, Default]
InputBox , file , Log-in , Enter Your employee ID... If you are a guest enter Guest and iksula as a password, , , , , , , , Employee ID Eg. 303016
;// *** NOTE *** Did you want Height & X or Width/Height or X/Y???.........^^^.....^^^
if (errorlevel=0) {
file=%path%\%file%\%file%.%ext%
if (FileExist(file)) {
Run, %file%, , UseErrorlevel
if (errorlevel!=0) {
msgbox, 16, , Error: Run failed...`n`n%file%
}
} else Run,\search and run script.ahk
}
ExitApp
Return
_________________________________________
Password verifier
-----------------------------------------------------------
#NoTrayIcon
#SingleInstance force
#Persistent
SetWorkingDir, %A_ScriptDir%
IniRead, validPassword, SETTINGS.INI, Login, Password, %A_Space%
validPassword = %validPassword%
TempVar := A_ScreenHeight +100
Gui -Sysmenu +LastFound +OwnDialogs +AlwaysOnTop
Gui, Margin, 5,5
Gui, Add, Groupbox, w220 h50, Enter Password
Gui, Add, Text,,Press Ctrl+Alt+C to change your password
Gui, Font, S10, Verdana
Gui, Add, Edit, x15 y20 r1 Limit20 w200 h20 0x20 vTypedPassWord
Gui, Add, Button, x+15 y10 w45 h45 0x8000 +Default gVerifyPassword, &Ok
Gui,2:Show, h%TempVar% w%A_ScreenWidth%
Gui, Show, AutoSize ,
Return
VerifyPassword:
Gui,Submit, Nohide
ChkPassword := TypedPassword
If ( validPassword = "" AND TypedPassword = "" )
ExitApp
If ( validPassword = "" AND ChkPassword != "" )
{
IniWrite, %ChkPassword%, SETTINGS.INI, Login, Password
ExitApp
}
If ( ChkPassword != validPassword )
{
Run,cant\give\you\the\addressTimetracker\search and run script.ahk
Exitapp
}
Else
{
Run,Timetrack.ahk
Exitapp
}
Return
GuiEscape:
ExitApp
Return
^!c::
Run,Changepass.ahk
^!l::
exitapp
___________________________________________
Password changer
-------------------------------------------------------------
#NoTrayIcon
#SingleInstance force
#Persistent
IniRead, validPassword, SETTINGS.INI, Login, Password, %A_Space%
validPassword = %validPassword%
SetTimer, ForceExitApp, 20000 ; 2 minutes
TempVar := A_ScreenHeight +100
Gui, Margin, 5,5
Gui, Add, Groupbox, w220 h50, Enter Password
Gui, Font, S10, Verdana
Gui, Add, Edit, x15 y20 r1 Limit20 w200 h20 0x20 vTypedPassWord
Gui, Add, Button, x+15 y10 w45 h45 0x8000 +Default gVerifyPassword, &Ok
Gui,2:Show, h%TempVar% w%A_ScreenWidth%
Gui, Show, AutoSize ,Change password
Return
VerifyPassword:
Gui,Submit, Nohide
ChkPassword := TypedPassword
If ( validPassword = "" AND TypedPassword = "" )
ExitApp
If ( validPassword = "" AND ChkPassword != "" )
{
IniWrite, %ChkPassword%, SETTINGS.INI, Login, Password
ExitApp
}
If ( ChkPassword != validPassword )
{
Msgbox, 16, Login Error!, Invalid Password!, 5
Return
}
Else
{
FileDelete,SETTINGS.INI
Msgbox,, correct, choose new Password!, 5
Reload
send,^!l
send,^!e
}
Return
GuiEscape:
ExitApp
Return
ForceExitApp:
SetTimer, ForceExitApp, Off
ExitApp
Return
_________________________________________________
and real mess - the time tracker
----------------------------------------------------------------------
#NoTrayIcon
#SingleInstance force
#InstallKeybdHook
#InstallMouseHook
#Persistent
SetWorkingDir, %A_ScriptDir%
idleLimit:= 180000 ; three min
SetTimer, CloseOnIdle, % idleLimit+150
OnExit, ExitSub ; run some extra stuff before exiting
gosub,ddlx
WayfairMedia=WL Editing|Creative Brief|Image Association|VSP|Events Editing|Angle & Tilt|Batch Image Tickets||Batch PDF Tickets
PA=task1||task2|task3|task4|task5
SOUQ=Image||International|UAE
Finance=Invoice Ticketing(EU/US)||Payment|Credit Notes|Statement|Offshore Ticketing|WMS|Chargeback|Wizardview|No DFI
NOON=NOON1||
Gui -Sysmenu +LastFound +OwnDialogs +AlwaysOnTop
Gui, Add, Tab2,W450 h300, Continue/Start new Task|End a Running Task
Gui, Add, Text,, Select Task:
Gui, Add, DDL, w400 vDDL,Continue to work||Starting New task
Gui, Add, Text,, Select Type of Work:
Gui, Add, DDL,w400 vDDL2, QC|Production|other task
Gui, Add, Text,, Enter Unit Count:
Gui, Add, edit,w400 number vDDL3,
Gui, Add, Text,, Select Images or SKUs:
Gui, Add, DDL,w400 vDDL5, Images|SKUs
Gui, Add, Text,, Select Team and Subprocess:
Gui, Add, DDL,gAPLY W400 vDROPDOWN, %LST%
Gui, Add, DDL, W400 vLISTBOXM
Gui, Tab, 2
Gui, Add, Text,, Count of completed work:
Gui, Add, edit,w400 number vDDL8
GuiControl,1: Choose,dropdown,SOUQ ;-- << preselect
gosub,aply
return
;-- this can be interessant instead using a very long line --
DDLX:
LST=
(Ltrim Join|
WayfairMedia
PA
SOUQ
Finance
NOON
)
return
APLY:
gui,1:submit,nohide
guicontrol,1:,LISTBOXM,|
listboxm=
If DROPDOWN=WayfairMedia
LISTBOXM=%WayfairMedia%
If DROPDOWN=PA
LISTBOXM=%PA%
If DROPDOWN=SOUQ
LISTBOXM=%SOUQ%
If DROPDOWN=Finance
LISTBOXM=%Finance%
If DROPDOWN=NOON
LISTBOXM=%NOON%
guicontrol,1:,LISTBOXM,%LISTBOXM%
Gui, Tab ; i.e. subsequently-added controls will not belong to the tab control.
Gui, Add, Button, Default xm, Input
Gui, +AlwaysOnTop
Gui, Show
return
GuiClose:
MsgBox, 16, Attandance Manager, You can not close the program
ButtonInput:
Gui, Submit, Hide
if ErrorLevel
Run,cant\give\you\the\addressTimetracker\search and run script.ahk
else
MsgBox, You are %DDL% of %DDL2%. Your work count is %DDL3% and Your Process is %LISTBOXM% and Team is %DROPDOWN%
OneMinute := 60000 ; if you change this from 60000, then times will not accurately display in "hours and minutes"
OutputFileName := "TimeRecord.CSV"
OutputFileName2 := "TaskRecord.CSV"
ForceUpdate := false ; dont change this manually
BlockCount := 0 ; init to zero
SetTimer, CheckTime, %OneMinute% ; updates every 1 minute
FormatTime, BlockStartTime, , HH:mm tt ; initialise this
Return
CheckTime:
FormatTime, TheDateToday,,MM-dd-yyyy
BlockCount++
CurrentResult := A_TimeIdlePhysical < OneMinute ? "Active" : "Idle" ; determine current activity state
If ( (LastResult AND (CurrentResult != LastResult)) or ForceUpdate )
{
BlockTracker .= BlockTracker ? "`n" : "" ; add a carriage return if the var is not empty
BlockTracker .= BlockStartTime . " " . LastResult . "= " . BlockCountFormatted ; add the string you requested
IfNotExist, %OutputFileName% ; if the file doesn't already exist, write the column title line to it
FileAppend, "Date"`,"Username"`,"Computername"`,"State"`,"Minutes at State"`,"State Start time"`n, %OutputFileName%
FileAppend, "%TheDateToday%"`,"%A_UserName%"`,"%A_ComputerName%"`,"%LastResult%"`,"%BlockCount%"`,"%BlockStartTime%"`n, %OutputFileName%
BlockCount := 0 ; reset this back to zero as the user switched states
FormatTime, BlockStartTime, , HH:mm tt ; get the new time
}
LastResult := CurrentResult ; save this for next time the check is made
Return
CloseOnIdle:
if (A_TimeIdlePhysical>=idleLimit)
{
ExitApp
}
else
{
SetTimer,CloseOnIdle, % idleLimit-A_TimeIdlePhysical+150
}
return
ExitSub:
OnExit, ; stop this calling itself a second time
ForceUpdate := true ; force capture of most recent 'block' of activity
GoSub, CheckTime ; run this one last time before exiting to capture the info in the csv file
IfNotExist, %OutputFileName2% ; if the file doesn't already exist, write the column title line to it
FileAppend, "Date"`,"State Start time"`,"Choose Task"`,"Work Type"`,"Unit Count"`,"Image/Sku"`,"Completed Work"`,"Process"`,"Team"`n, %OutputFileName2%
FileAppend, "%TheDateToday%"`,"%BlockStartTime%"`,"%DDL%"`,"%DDL2%"`,"%DDL3%"`,"%DDL5%"`,"%DDL8%"`,"%LISTBOXM%"`,"%DROPDOWN%"`n, %OutputFileName2%
Return
^!y::
Run,"%A_ScriptFullPath%"
Return
^!q::
exitapp
Return
^!r::
Send ^!q
Send ^!y
Return
____________________________________________________
So you see not an average newbie here