Skip to content

Instantly share code, notes, and snippets.

;*******************************************************
; Want a clear path for learning AHK; Take a look at our AutoHotkey courses.
; They're structured in a way to make learning AHK EASY: https://the-Automator.com/Learn
;*******************************************************
; Create certificate
$cert = New-SelfSignedCertificate -Subject "{CertName}" -CertStoreLocation "cert:\CurrentUser\My" -HashAlgorithm sha256 -type CodeSigning
; Create password
$pwd = ConvertTo-SecureString -String "{123456}" -Force -AsPlainText
Example Chat GPT-3 API call
var = 0: "Admission"1: "Student Details"2: "Alumini Details"3: "Print Student Details"
f := 1
while f
{
f := RegExMatch(var, x := "[" chr(34) "](\w+)[" chr(34) "]", $, f+1)
msgbox, % $1
}
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey courses.
;They're structured in a way to make learning AHK EASY: https://the-Automator.com/Learn
;*******************************************************
SetBatchLines,-1
#SingleInstance,Force
;********************Excel Safe array***********************************
XL:=XL_Handle(1) ;Connect to Excel
sArr :=xl.Range["a1:L29"] ;Store the content of the array into sArr
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey courses.
;They're structured in a way to make learning AHK EASY: https://the-Automator.com/Learn
;*******************************************************
#SingleInstance,Force ;only allow one instance
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SetBatchLines,-1 ;run the script as fast as possible
Setkeydelay,0 ;reduce key delay to smallest time period
SetWorkingDir, %A_ScriptDir% ; Ensures a consistent starting directory.
SendMode, Input ; Recommended for new scripts due to its superior speed and reliability.
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey courses.
;They're structured in a way to make learning AHK EASY: https://the-Automator.com/Learn
;*******************************************************
#Include <default_Settings>
;**************************************
/*
Tick:=A_TickCount
FileRead,Text,%A_AhkPath%\..\License.txt
m(A_TickCount-Tick)
#Requires AutoHotkey v1.1.33+
#requires 32 bit version of AutoHotkey
MsgBox % URiEncode("https://the-Automator.com?Src=news&id=1211")
uriDecode(str) {
Loop
If RegExMatch(str, "i)(?<=%)[\da-f]{1,2}", hex)
StringReplace, str, str, `%%hex%, % Chr("0x" . hex), All
Else Break
;****************copy path of file selected to clipboard***************************************
#IfWinActive ahk_class CabinetWClass ;Explorer window
^+c:: ;Copy explorer path to clipboard
clipboard = ; Empty the clipboard
SendInput , ^c ;changd from Send 11/23
ClipWait, 1
If ErrorLevel ;Added errorLevel checking
{
MsgBox, No text was sent to clipboard
Return
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
#SingleInstance Force
^g:: ;Control G pastes plain text
Store:=ClipboardAll ;Store full version of clipboard
ClipBoard := ClipBoard ; Convert to plain text
Sleep, 50
SendInput, ^v ;paste plain text
;~ #Include <default_Settings>
#SingleInstance,Force
;**************************************
SetTitleMatchMode 2
OBJID_NATIVEOM := -16
;********************if Word is active***********************************
ControlGet, hwnd, hwnd, , % "_WwG1", % "- Word ahk_class OpusApp" ;identify the hwnd for Word
;********************Now apply to which ever one is active***********************************