• Become a Power user Intro to AutoHotkey Intermediate AutoHotkey Intermediate Objects GUIs are Easy w/AutoHotkey Painlessly switch from V1 to V2

One-Line Operators in AutoHotkey are a great way

One-Line Operators in AutoHotkey

One-Line Operators in AutoHotkey are a great way to streamline / condense your code!  In the below video I walks through how to use them.  While I use them in a loop, this was merely an easy way to demonstrate them.

One-Line Operators in AutoHotkey Video Tutorial

Example AutoHotkey code of One-Line Operators in AutoHotkey



Loop, parse, Var, `n, `r ;loop over Var line by line
    myVar:=A_Index ;increment myVar

IfEqual, A_Index,1,continue ;skip processing header/1st row
IfEqual, A_LoopField,,continue ;Skip loop if A_Loopfiled is blank
IfEqual, A_Index,3,SetEnv,Data,New Value ;If A_Index is 3 set data:="New Value"
IfEqual, A_Index,5, Sleep, 2000 ;Sleep for 2 seconds on 3 
IfEqual, myVar,6,EnvAdd,myVar, 2 ;If myVar=6 add 2 to myVar
IfEqual, A_LoopField,three,break ;Note- need to use percents if variable    
IfEqual, A_index, 4, ExitApp ;Exit app if get to 10
IfLess, A_Index,6,FileAppend,%A_Loopfield%`r`n,test.txt,utf-8  ;If A_Index <6, write A_loopfield to test.txt
IfEqual, A_Index,4,ListVars
MsgBox % "index: " A_Index A_Enter "LoopField: " A_LoopField A_Enter "Data: " Data A_Enter "myVar: " myVar

Use an SPSS Macro to Open and Save Hundreds /Thousands of similar Files

SPSS macro to open and save

Using an SPSS Macro to Open and Save files can be quite a time saver!  In my example code & video I demonstrate how to adapt basic SPSS syntax into a macro that automates the process.   I also mention this macro which takes the reverse approach (automatically breaks the file into random groups).

The below code it just an example using SPSS macro to open and save text files which will have to be adapted to your needs.  Be sure to pay close attention to string variables and the widths you set them at.  Generally speaking, set them at double what SPSS assigns them.  In reality, there doesn’t seem to be any file-size change when you make them very wide so you also might just default to setting the width to 10X the width (then shrink the column widths with the Var Width command.

In the video I also demonstrate how I used Excel to help write my syntax for looping over all the files as well as merging the files together.

SPSS macro to open and save Text files

DEFINE !OpenSav (In_Path !TOKENS (1) /Out_Path !TOKENS (1) / File_Name !TOKENS (1) )
 script "B:\SPSS\Scripts\Empty.sbs".
GET DATA  /TYPE=TXT  /FILE=!In_Path + !File_Name + ".txt"
 Company A120
 City A30
 State F3.0
 Sales_Rev F11.0
 Num_Emp F6.0.
Var width All (5) company city (10) .
SAVE OUTFILE=!Out_Path + !File_Name + ".sav"  /COMPRESSED.
!OpenSav In_Path="H:\temp\Files\"  Out_Path="H:\temp\Out\"    File_Name="Rand_1".

Video demonstrating using an SPSS macro to open and save files


Click window to toggle programs across monitors with AutoHotkey

toggle programs across monitorsToggle programs across monitors with AutoHotkey

Do you work with multiple monitors?  I have an awesome AutoHotkey script which allows me to simply hold down Alt and mouse-click on a program and it will “throw” it to the other monitor!.

Toggle programs across monitors with AutoHotkey

Here is the AutoHotkey Script to toggle programs across monitors

Being able to toggle programs across monitors is an amazing thing!

Web Scraping Example with AutoHotkey-Scraping website to determine status

Web Scraping Example with AutoHotkey

The term Web Scraping is well known but I’ve yet to hear much talk about “Web Pasting”.   In this Web Scraping Example with AutoHotkey video I demonstrate how I helped my Real Estate agent automate checking the status of a house on a website.

Web Scraping example with AutoHotkey

Here is a second version where, depending on the status of the home, I write a follow-up email either with an email from Outlook or within the website via COM.