Video Hour 1: High-level overview: Hour 1
Script highlight: Encoding text for some security of passwords
Original script with GoSubs
;******************************************************* x:=0 ToolTip Pre gosub`nThe value is: %X%`nSleep is 3300 sleep, 3300 ;************************************** GoSub Start GoSub,Middle GoSub,End return ;******************************************************* Start: x+=50 ToolTip I'm at Start `nValue is %x%`nSleep is 3000 Sleep, 3000 ToolTip Return ;******************************************************* Middle: x+=150 ToolTip Now I'm Middle`nValue is: %x%`nsleeping 3200 Sleep, 3200 ToolTip Return ;******************************************************* End: x+=350 ToolTip And finally at End`nValue is: %x%`nsleeping 4000 Sleep, 4000 ToolTip Return
Version with a Function
x:=0 x:=Add_Display_and_Sleep(3300,"I'm here `nValue is",x,50) ;CAll that function x:=Add_Display_and_Sleep(3000,"I'm at Middle `nValue is",x,100) ;CAll that function x:=Add_Display_and_Sleep(4300,"I'm at End `nValue is",x,200) ;CAll that function x:=Add_Display_and_Sleep(2300,"I'm at one more `nValue is",x,500) ;CAll that function return Add_Display_and_Sleep(Sleep_Time,Message,x,Value_Add){ x+=Value_Add ToolTip %Message% %x%`nSleep is %Sleep_Time% Sleep, %Sleep_Time% ToolTip Return x }
Script Walk Through
Below is the version Jackie walked through in the webinar which utilized the old “pre COM” approach. I found there is a a newer version of the Taskbar Notification script which doesn’t use the old COM interface
var= ( One Two three four ) ;*********Use For loop over Var going line by line********************* for i, row in Loopobj:=StrSplit(var,"`n","`r") { ;use For loop to parse over line breaks TaskbarProgress((i/(Loopobj.maxindex()))*100 ,"P",WinExist("ahk_class AutoHotkeyGUI")) ;pwb is to IE, N=green, P=Yellow E=Red ;Taskbar notifier for loop MsgBox % Row " and percent: " round((i/(Loopobj.maxindex()))*100) "%" } return TaskbarProgress(pct, state="", hwnd=""){ static tbl, s0:=0, sI:=1, sN:=2, sE:=4, sP:=8 if !tbl { COM_Init() ; Create a TaskbarList object with ITaskbarList3 interface: if DllCall("ole32\CoCreateInstance", "uint", COM_GUID4String(CLSID,"{56FDF344-FD6D-11d0-958A-006097C9A090}"), "uint", 0, "uint", 21, "uint", COM_GUID4String(IID,"{ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf}"), "uint*", tbl) != 0 { MsgBox 16,, Error creating TaskbarList object. Is this script running on Windows 7? Exiting. ExitApp } } if hwnd = hwnd := WinExist() if pct is not number state := pct, pct := "" else if (pct = 0 && state="") state := 0, pct := "" if state in 0,I,N,E,P ; ITaskbarList3::SetProgressState DllCall(NumGet(NumGet(tbl+0)+40), "uint", tbl, "uint", hwnd, "uint", s%state%) if pct != ; ITaskbarList3::SetProgressValue DllCall(NumGet(NumGet(tbl+0)+36), "uint", tbl, "uint", hwnd, "int64", pct*10, "int64", 1000) } ;********************From ; COM.ahk Standard Library ; by Sean ; http://www.autohotkey.com/forum/topic22923.html*********************************** COM_Init(bUn = ""){ Static h Return (bUn&&!h:="")||h==""&&1==(h:=DllCall("ole32\OleInitialize","Uint",0))?DllCall("ole32\OleUninitialize"):0 } COM_GUID4String(ByRef CLSID, String){ VarSetCapacity(CLSID,16,0) DllCall("ole32\CLSIDFromString", "Uint", &String, "Uint", &CLSID) Return &CLSID }