24
Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner Robert Wilson

Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Unplug Your Mouse Workflow Automation

with AutoHotKey

Andrew Weidner

Robert Wilson

Page 2: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Mice make simple things easy and complex things impossible.

Page 3: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Mice make simple things easy and complex things impossible.

Mice are useful and fun, but they tend to slow down repetitive file management tasks.

Do things faster with your keyboard.

Page 4: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Keyboard Optimization: why type fifty-two keys when you can do the same thing with two?

(Ctrl + 4)

Page 5: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Overview

• Keyboard Shortcuts

• AutoHotkey Scripts

• Tools & References

• Demonstration

Page 6: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Keyboard Shortcuts

Windows Explorer

Tab = cycle fields (add Shift to reverse)

Alt + Tab = application switcher

Enter = open selected file/folder

Backspace = return to parent folder

Alt + F + M = rename selected file/folder (also F2)

Alt + F + W + F = create a new folder

Home/End = go to first/last file

Page 7: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Keyboard Shortcuts

ACDSee Viewer

Page Down = next image

Page Up = previous image

(NumPad) * = fit image to window

(NumPad) + = zoom in

(NumPad) - = zoom out

Arrow Keys = move around the image

Home/End = go to first/last image

Page 8: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Keyboard Shortcuts

Mozilla Firefox

Ctrl + T = open new tab

Ctrl + Tab = cycle tabs (add Shift to reverse)

Alt + Left = go to previous page (also Backspace)

Ctrl + L = focus on address bar

Tab = cycle links (add Shift to reverse)

Arrow Keys = scroll through the page

Ctrl + B = show/hide bookmarks sidebar

Page 9: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

AutoHotkey Scripts

Simple: another Enter key

; plain text file with .AHK extension

; comments begin with a semicolon

; define the hotkey: Alt + a

!a::

; define the action

Send, {Enter}

Page 10: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

AutoHotkey Scripts

Simple: type some text

; hotkey: Ctrl + 1

^1::

; use the ` symbol before a literal comma

; `n inserts a new line, `t inserts a tab

Send, Sincerely`,`n`t

Page 11: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

AutoHotkey Scripts

Complex: create a folder

; hotkey: Win + k

#k::

Send, {AltDown}f{AltUp}

Sleep, 200

Send, w

Sleep, 200

Send, f

Page 12: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

AutoHotkey Scripts

Complex: rename a file

; hotkey: Ctrl + Alt + r

^!r::

Send, {F2}

Sleep, 200

Send, {Home}

Sleep, 200

Send, 2013

Page 13: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

AutoHotkey Scripts

Complex: paste a file in multiple folders

Pause::Pause ; pause script with the Pause key

!v:: Send, {CtrlDown}v{CtrlUp} sleep, 400 Loop { Send, {Backspace} Sleep, 1400 Send, {Down} Sleep, 400 Send, {Enter} Sleep, 800 Send, {CtrlDown}v{CtrlUp} Sleep, 400

}

Page 14: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

AutoHotkey Scripts

Complex: open with Photoshop

NumpadDot & NumpadEnter:: ClipMem = %Clipboard% ; save current clipboard value clipboard = Send, ^c ; copy the file name ClipWait

; insert the file name at the end of the Photoshop Run command Run, C:\Program Files\Adobe\Adobe Photoshop CS5 (64 Bit)\Photoshop.exe %clipboard% clipboard = %ClipMem% ; restore the original clipboard value Return

Page 15: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

AutoHotkey Scripts

Application: ETD_Metadata

Finds keywords in author-provided metadata

and enters them in an XML file.

Page 16: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

ETD Metadata: Part 1

#Home:: DefinedAddress = DefinedKeywords = KeywordMeta = Clipboard = SendInput, {F4}{ControlDown}a{ControlUp} sleep, 200 Send ^c ClipWait Sleep, 100 DefinedAddress = %clipboard% SetWorkingDir, %DefinedAddress% Run, Wordpad.exe index.docx WinWaitActive, index

Open author-provided metadata

Declare blank variables for future use

Copy file path

Assign file path to variable

Open index.docx file in Wordpad

Page 17: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

ETD Metadata: Part 2

Keywords: Sleep, 100 clipboard = SendInput, {CtrlDown}f{CtrlUp} WinWaitActive, Find Sleep, 100 SendInput, Keywords Sleep, 100 SendInput, {Enter}{Esc} Sleep, 100 SendInput, {Tab} Send ^c ClipWait DefinedKeywords = %clipboard%

Function title

Open Find dialog

Type ‘Keywords’

Copy text

Store text in variable for later use

Find Keywords

Page 18: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

ETD Metadata: Part 3

/* Comma + space occurrences in DefinedKeywords variable are replaced

with Tab so keywords are sent to appropriate fields later */

StringReplace, DefinedKeywords, DefinedKeywords, `,%A_Space%, %a_tab%, all

; create window for keyword input, separated into individual variables

KeywordWindow:

Gui, 30:+AlwaysOnTop

Gui, 30:Add, Text, x6 y6 w100, Keyword1:

Gui, 30:Add, Edit, x6 y+5 w100 vKeyword1

Gui, 30:Add, Text, x6 y6 w100, Keyword2:

Gui, 30:Add, Edit, x6 y+5 w100 vKeyword2

; code repeats to Keyword10

Create GUI for Keyword Input

Page 19: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

ETD Metadata: Part 4

; submit each field as a defined variable: Keyword1-10

Gui, 30:Add, Button, x6 default, OK

Gui, 30:Show,, Keywords

Sleep, 100

WinActivate, Keywords

SendInput, %DefinedKeywords%

Sleep, 100

30GuiClose:

30ButtonOK:

Gui, 30:Submit

Send Keywords

Create OK Button

Send formatted keywords

Close Window

Page 20: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

ETD Metadata: Part 5

IfExist, C:\Program Files\jEdit\jedit.exe

Run, C:\Program Files\jEdit\jedit.exe metadata.xml

Else

Run, C:\Program Files\jEdit\jedit.bat metadata.xml

WinWait, jEdit

Sleep, 1000

SendInput, ^{Home}

Sleep, 200

Send, {ControlDown}f{ControlUp}

Sleep, 200

Open Metadata XML File Open metadata.xml in jEdit (.exe or .bat)

Wait for jEdit to load the file

Move to top of file

Open Search window

Page 21: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Wait for Search window to open

Search for ‘#Keywordmeta’

Close Search window ‘#Keywordmeta’ is highlighted

ETD Metadata: Part 6

Prepare for Keyword Entry WinWait, Search And Replace,

IfWinNotActive, Search And Replace, , WinActivate, Search And Replace,

WinWaitActive, Search And Replace,

SendInput, {#}{ShiftDown}k{ShiftUp}eywordmeta{Enter}

Sleep, 200

SendInput, {Esc}

Types ‘#Keywordmeta’

Page 22: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

ETD Metadata: Part 7

If (Keyword1 <> "")

SendInput, <subject qualifier="KWD">%Keyword1%</subject>

Sleep, 100

If (Keyword2 <> "")

SendInput, `r<subject qualifier="KWD">%Keyword2%</subject>

Sleep, 100

; code repeats to Keyword10

Enter Keywords Send keywords stored in

variables (IF they exist!)

Page 23: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Tools & References

• AutoHotkey Recorder: produces script code

• Mobile AutoHotkey: use on any Windows system

• AutoIt Window Spy: screen coordinates & title info

• Website: www.autohotkey.com

• Documentation: www.autohotkey.com/docs

• Forum: www.autohotkey.com/board

Page 24: Unplug Your Mouse - UNT Digital Library/67531/metadc...Unplug Your Mouse Workflow Automation with AutoHotKey Andrew Weidner ... Do things faster with your keyboard. Keyboard Optimization:

Demonstration

• ETD_Metadata (rw)

• SuperPaste (rw)

• OpenWithPhotoshop (rw)

• TDNP_Microfilm (aw)

• NewspaperNotes (aw)

• DashboardTools (aw)