From 84febe0f2145a22b31057d21bbb660a50d263bfb Mon Sep 17 00:00:00 2001 From: breadcat Date: Tue, 9 Jun 2015 00:09:27 +0100 Subject: Further improvements Improve XP file renaming function Add more hotstrings Standardised clipboard variable names. Variables are also cleared after use. --- ahk-assistant.ahk | 18 +++++++++++++++--- functions.ahk | 41 +++++++++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/ahk-assistant.ahk b/ahk-assistant.ahk index 0251c5e..9c45709 100644 --- a/ahk-assistant.ahk +++ b/ahk-assistant.ahk @@ -6,11 +6,14 @@ #NoEnv #SingleInstance,Force SetTimer, ScriptReload, 1000 -SetWinDelay,2 +SetWinDelay,0 +SetKeyDelay,0 +SetControlDelay,0 CoordMode,Mouse SetWorkingDir %A_MyDocuments%\..\ ProgramFilesX86 := A_ProgramFiles . (A_PtrSize=8 ? " (x86)" : "") ;pfx86 variable from http://www.autohotkey.com/board/topic/79160-a-programfiles-for-programs-in-windows-7-x86-directory/ + ;keystates SetCapsLockState, AlwaysOff SetScrollLockState, AlwaysOff @@ -82,10 +85,10 @@ Insert::appendClipboard() #NumpadIns::winSplitH() ;text replacements -:*:_r:: +:*?:_reg:: insertRegards() Return -:*:_kr:: +:*?:_kreg:: insertKindRegards() Return :*:_em:: @@ -161,6 +164,10 @@ Insert::appendClipboard() :*?:(tm)::™ :*?:(ee)::€ :*?:(deg)::° +:*?:(half)::½ +:*?:(quart)::¼ +:*?:(div)::÷ +:*?:(micro)::µ ;stupid fingers :*:seperated::separated :*:seperate::separate @@ -213,6 +220,11 @@ Insert::appendClipboard() :*:_btd::BT Diverse 7110+ ;application specific hotkeys +#IfWinActive ahk_class #32770 ;save/load dialog + F1:: ;overflow to rename, help is useless in explorer + F2::explorerRename() ;rename commands +#IfWinActive + #IfWinActive ahk_class CabinetWClass ;explorer CapsLock::explorerUp() Alt & Enter:: ;overflow diff --git a/functions.ahk b/functions.ahk index 84c4ef1..06eb4b6 100644 --- a/functions.ahk +++ b/functions.ahk @@ -1,3 +1,4 @@ + dirWorking() { If A_OSVersion in WIN_XP { @@ -59,9 +60,10 @@ insertDateTime() { } appendClipboard() { - newclipboard = %clipboard% + backupClipboard = %clipboard% Send, ^c - clipboard = %newclipboard%`r`n%clipboard% + clipboard = %backupClipboard%`r`n%clipboard% + backupClipboard = Return } @@ -78,16 +80,18 @@ pasteTelephone() { StringLeft, 5Digits, clipboard, 5 StringRight, 6Digits, clipboard, 6 Send %5Digits% %6Digits% + 5Digits = + 6Digits = Return } dialTelephone() { ;lg phone-link - ClipSaved := ClipboardAll + backupClipboard := Clipboard Send, ^c StringReplace, clipboard, clipboard, +44, 0, All ;translate intl codes Run, dial://%clipboard% ;must enable internet dialling to work - Clipboard := ClipSaved - ClipSaved = + Clipboard := backupClipboard + backupClipboard = Return } @@ -166,9 +170,18 @@ explorerUp() { ;up one folder } explorerRename() { - If A_OSVersion in WIN_XP - { - Send {F2}{CtrlDown}{Home}{ShiftDown}{End}{CtrlUp}{Left 4}{ShiftUp} ; Rename (hopefully) deselects file extension + If A_OSVersion in WIN_XP ;deselect file extension by determining final . character + { + backupClipboard = %Clipboard% + Send {F2}{CtrlDown}c{CtrlUp} + StringGetPos,ExtensionPos, Clipboard,.,R + if (ExtensionPos != -1) + { + Position := StrLen(Clipboard) - ExtensionPos + Send, +{Left %Position%} + } + Clipboard = %backupClipboard% + backupClipboard = } Else { @@ -178,11 +191,11 @@ explorerRename() { } explorerCMD() { ;open command prompt in current location - ClipSaved := ClipboardAll + backupClipboard := Clipboard Send !d^c Run, cmd /K "cd `"%clipboard%`"" - Clipboard := ClipSaved - ClipSaved = + Clipboard := backupClipboard + backupClipboard = Return } @@ -340,11 +353,11 @@ insertPostCode() { searchCustomer() { global crmSearch - ClipSaved := ClipboardAll + backupClipboard := Clipboard Send, ^c Run, %crmSearch%%clipboard% - Clipboard := ClipSaved - ClipSaved = + Clipboard := backupClipboard + backupClipboard = Return } -- cgit v1.2.3