In continuation to my time tracking project I run into a big problem employee of my comp. find out that they can close the script from Task manager so i try to find a way to hide script from task manager but all i get is "are you making a trojan or something? " so it's ok if they see are able to see the script in task manager but not able to close it only user with admin access can close the script.
Please help me improve my script so i can do that #NoTrayIcon only hide script from tray and taskbar
Code: Select all
#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,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