• Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey GUIs are Easy with AutoHotkey Intro to DOS & AutoHotkey AutoHotkey FAQ AutoHotkey FAQ

AutoHotkey Webinar- Working session for November 2019

This, and future, webinars are going to be “working sessions” where we help people with their scripts or work-through a script from the forum, etc.  If you have suggestions / problems and want to submit a script for the next webinar, email me at  Joe@the-Automator.com

Video Hour 1: High-level overview: Hour 1
Video Hour 2: Q&A: Hour 2

Here is the script that Maestrith (Chad Wilson, author of AHK Studio) worked out with Dale

#SingleInstance,Force
#Persistent
global Info
SetHotkeys(1)
for a,b in Info:={"c99":"()","c88":"[]","c77":"{{}{}}"}{
  Hotstring(":X*:" a,"HString")
}
return
KeyEvent(a*){
  delay := A_TickCount + 375 ;wait this time in ms to cap letter, lower number = smaller wait
  capped := false
  key := SubStr(A_ThisHotkey,2,1)				;hotkey is ~a etc, so remove the ~
  while(GetKeyState(key,"P")) {
    if ( (!capped) AND (a_tickcount > delay)) {
      SendInput,	{BackSpace}{shift Down}%key%{shift Up}
      hotkey,	%key%,nada,on ;assign key to a nil event, so that windows doesn't spam it ie aaaaaaa
      capped := true 			;capped set to true so that script does not repeat
    }
  }
  if (capped)
    hotkey,~%key%,keyEvent,on  ;assign key back to this event
}
HString(){
  static Key	
  String:=SubStr(A_ThisHotkey,InStr(A_ThisHotkey,":",,,2)+1)
  SendInput,% Info[String] "{Left}"
  Input,Key,L1
  SendInput,+{%Key%}
  return
}
return
nada:
return
SetHotkeys(On:=0){
  Alphabet := "abcdefghijklmnopqrstuvwxyz-=,./;'[]\``"
  for a,b in StrSplit(Alphabet){
    Hotkey,~%b%,KeyEvent,% (On?"On":"Off")
  }
  return
}

 

Sign up for future webinars

See past AutoHotkey webinars

 

AutoHotkey Webinar- Converting GoSubs to a Function and Script walk through

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
}

 

How to use Simple Text Encrypting to prevent keeping your passwords stored in plain text files – Keep hackers away in 2021!

Simple Text EncryptingIn one of my videos on what I’ve automated lately, I demonstrated the little tool I wrote to encode / decode text (typically passwords). Someone asked if I could share the code so I’m doing that here. In case you missed the video, I created a shorter one just on this topic below.

Text Encrypting Code

How to use Simple Text Encrypting

 

 

Tutorial on Encoding binary data to a string with Maestrith

In the second half of our webinar on Finding and Clicking Text / Pixels / Images someone asked about encoding a binary image to Base64, then being able to decode it back for usage (this will allow them not to have to share the actual image files.)

I’ve never done any of this so I was lost but thankfully Jackie and Maestrith had experience in it.   The other night I mentioned it to Maestrith and he generously offered to work through a couple of examples and explain the process to me.
Continue reading