-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84b685f
commit 0d32487
Showing
20 changed files
with
70 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 47 additions & 33 deletions
80
Keyboard-Maestro/Renumber-Macro-Prefix-Numbers.applescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,53 @@ | ||
use AppleScript version "2.4" -- Yosemite (10.10) or later | ||
use scripting additions | ||
|
||
tell application "System Events" | ||
display dialog "Enter the starting number or click clear to remove number prefix." default answer 0 with title "Renumber Macro Prefix Numbers" buttons {"Cancel", "Clear", "OK"} default button "OK" | ||
end tell | ||
tell result | ||
set buttonReturned to button returned | ||
set strt to text returned as number | ||
end tell | ||
|
||
|
||
tell application "Keyboard Maestro" | ||
set sel to selection | ||
if class of item 1 of sel ≠ macro then error "Invalid selection, please select macro(s)" | ||
set n to strt | ||
repeat with m in sel | ||
set nm to m's name | ||
try | ||
tell application "Keyboard Maestro" | ||
|
||
if buttonReturned = "Clear" then | ||
set newname to characters 4 thru -1 of nm as text | ||
tell m | ||
set name to newname | ||
end tell | ||
else | ||
if n < 10 then set n to "0" & n | ||
tell m | ||
if character 3 of nm is ")" then | ||
set newname to n & (characters 3 thru -1 of nm) as text | ||
else | ||
set newname to (n & ")" & nm) as text | ||
set dialogResult to display dialog ¬ | ||
"Enter the starting number or click clear to remove number prefix." default answer 0 ¬ | ||
with title "Renumber Macro Prefix Numbers" buttons {"Cancel", "Clear", "OK"} ¬ | ||
default button "OK" with icon ¬ | ||
POSIX file "/System/Volumes/Data/Applications/Keyboard Maestro.app/Contents/Resources/kmicon.icns" | ||
set startNum to dialogResult's text returned as number | ||
|
||
set sel to selection | ||
if class of item 1 of sel ≠ macro then error "Invalid selection, please select macro(s)" | ||
set n to startNum | ||
repeat with m in sel | ||
set oldname to m's name | ||
|
||
if dialogResult's button returned = "Clear" then | ||
|
||
if character 3 of oldname = ")" then -- 2 digit number prefix | ||
set newname to characters 4 thru -1 of oldname as text | ||
else if character 2 of oldname = ")" then -- 1 digit number prefix | ||
set newname to characters 3 thru -1 of oldname as text | ||
else -- doesn't have a number prefix | ||
set newname to oldname | ||
end if | ||
|
||
else | ||
if n < 10 then set n to "0" & n | ||
|
||
if character 3 of oldname is ")" then | ||
set newname to n & (characters 3 thru -1 of oldname) as text | ||
else if character 2 of oldname is ")" then -- 1 digit number prefix | ||
set newname to n & (characters 2 thru -1 of oldname) as text | ||
else -- doesn't have a number prefix | ||
set newname to (n & ")" & oldname) as text | ||
end if | ||
set name to newname | ||
end tell | ||
set n to n + 1 | ||
end if | ||
end repeat | ||
end tell | ||
set n to n + 1 | ||
|
||
end if | ||
set m's name to newname | ||
end repeat | ||
end tell | ||
|
||
on error errMsg number errNum | ||
if errNum ≠ -128 then | ||
display dialog errMsg & return & return & errNum buttons {"Cancel", "OK"} ¬ | ||
default button "OK" with icon caution | ||
end if | ||
end try | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[*library:al::Alfred Library]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[*library:acl::AppleCare Library]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[*library:bl::BetterTouchTool Library]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[*library:kl::Kevin's Library]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[*library:cl::coreGUIelements]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[template:applicationhfs]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[template:applicationposix]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
display dialog "[[template:message]]" buttons {[[template:"Cancel", "OK"]]} default button [[template:"OK"]] | ||
set [[template:dialogResult]] to display dialog ¬ | ||
"[[template:message]]" buttons {[[template:"Cancel", "OK"]]} ¬ | ||
default button [[template:"OK"]] ¬ | ||
default answer [[template:answer]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
do shell script "[[template:theShell]]" |
4 changes: 3 additions & 1 deletion
4
Script-Debugger/My-Clippings/duplicate & comment line|block.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
[[selected-lines:default text]] | ||
-- [[selected-lines:default text]] | ||
(* | ||
[[selected-lines:default text]] | ||
*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
display dialog [[template:errMsg]] & return & return & errNum buttons {"Cancel", "OK"} default button "OK" | ||
display dialog [[template:errMsg]] & return & return & errNum buttons {"Cancel", "OK"} ¬ | ||
default button "OK" with icon caution |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
first group of [[template:aList]] |
5 changes: 0 additions & 5 deletions
5
Script-Debugger/My-Clippings/tell System Events - tell "Core".txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[template:applicationposix]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
set the clipboard to [[selection:clipVar]] | ||
tell application "System Events" | ||
tell process "[[template:appName]]" | ||
keystroke "v" using {command down} | ||
end tell | ||
end tell | ||
tell application "System Events" to keystroke "v" using {command down} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
whose name is [[template:varname]] | ||
whose name contains [[template:varname]] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.