diff --git a/README.md b/README.md index 8281052..2d5e4a7 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,9 @@ Rename symbol instances to the name of their master. # Usage -* cmd option shift d - Rename all symbol instances in document to the name of their master -* cmd option shift p - Rename all symbol instances on page to the name of their master +* cmd option shift d - Rename all symbol instances on all pages to the name of their master +* cmd option shift x - Rename all symbol instances on all pages, except the Symbols page, to the name of their master +* cmd option shift p - Rename all symbol instances on current page to the name of their master * cmd option shift s - Rename selected symbol instances to the name of their master ## Automatic @@ -39,6 +40,7 @@ To find your plugins directory... # Changelog +* **2.3** - Added new function to rename all instances on all pages, except Symbols page. Added fix for when the master for an instance is missing. * **2.2** - Added appcast plugin support for Sketch 45 and later. Added new function to rename all instances on current page. New shortcuts. # Contact diff --git a/Symbol Instance Renamer.sketchplugin/Contents/Sketch/manifest.json b/Symbol Instance Renamer.sketchplugin/Contents/Sketch/manifest.json index 258a5e9..fdea3f9 100644 --- a/Symbol Instance Renamer.sketchplugin/Contents/Sketch/manifest.json +++ b/Symbol Instance Renamer.sketchplugin/Contents/Sketch/manifest.json @@ -2,19 +2,28 @@ "author" : "Jason Burns", "commands" : [ { - "name" : "Rename All Instances in Document", + "name" : "Rename All Instances on All Pages", "shortcut" : "cmd option shift d", - "identifier" : "renameDocument", - "description" : "Rename all symbol instances in document to the name of their master.", + "identifier" : "renamePages", + "description" : "Rename all symbol instances on all pages to the name of their master.", "script" : "script.cocoascript", "icon" : "icon-sr.png", - "handler" : "renameDocument" + "handler" : "renamePages" }, { - "name" : "Rename All Instances on Page", + "name" : "Rename All Instances on All Pages (Except Symbols Page)", + "shortcut" : "cmd option shift x", + "identifier" : "renamePagesExceptSymbols", + "description" : "Rename all symbol instances on all pages, except the Symbols page, to the name of their master.", + "script" : "script.cocoascript", + "icon" : "icon-sr.png", + "handler" : "renamePagesExceptSymbols" + }, + { + "name" : "Rename All Instances on Current Page", "shortcut" : "cmd option shift p", "identifier" : "renamePage", - "description" : "Rename all symbol instances on page to the name of their master.", + "description" : "Rename all symbol instances on current page to the name of their master.", "script" : "script.cocoascript", "icon" : "icon-sr.png", "handler" : "renamePage" @@ -32,13 +41,14 @@ "menu" : { "title" : "Symbol Instance Renamer", "items" : [ - "renameDocument", + "renamePages", + "renamePagesExceptSymbols", "renamePage", "renameSelected" ] }, "identifier" : "com.sonburn.sketchplugins.symbol-instance-renamer", - "version" : "2.2", + "version" : "2.3", "description" : "Rename symbol instances to the name of their master.", "authorEmail" : "jason.burns@synchronoss.com", "name" : "Symbol Instance Renamer", diff --git a/Symbol Instance Renamer.sketchplugin/Contents/Sketch/script.cocoascript b/Symbol Instance Renamer.sketchplugin/Contents/Sketch/script.cocoascript index ae38aae..76d3a03 100644 --- a/Symbol Instance Renamer.sketchplugin/Contents/Sketch/script.cocoascript +++ b/Symbol Instance Renamer.sketchplugin/Contents/Sketch/script.cocoascript @@ -1,4 +1,8 @@ -var renameDocument = function(context) { +var strPluginName = "Symbol Instance Renamer", + strRenameSuccess = " symbol instances have been renamed", + strRenameFailure = "Select at least one symbol instance to rename."; + +var renamePages = function(context) { var pages = context.document.pages(), loop = pages.objectEnumerator(), page, @@ -8,13 +12,28 @@ var renameDocument = function(context) { count = count + renameInstancesOnPage(page); } - context.document.showMessage(count + " symbol instances have been renamed in your document"); + context.document.showMessage(count + strRenameSuccess); +} + +var renamePagesExceptSymbols = function(context) { + var pages = context.document.pages(), + loop = pages.objectEnumerator(), + page, + count = 0; + + while (page = loop.nextObject()) { + if (page != context.document.documentData().symbolsPage()) { + count = count + renameInstancesOnPage(page); + } + } + + context.document.showMessage(count + strRenameSuccess); } var renamePage = function(context) { var count = renameInstancesOnPage(context.document.currentPage()); - context.document.showMessage(count + " symbol instances have been renamed on this page"); + context.document.showMessage(count + strRenameSuccess); } var renameSelected = function(context) { @@ -29,9 +48,9 @@ var renameSelected = function(context) { if (renameInstance(instance)) count++; } - context.document.showMessage(count + " symbol instances have been renamed in your selections"); + context.document.showMessage(count + strRenameSuccess); } else { - NSApplication.sharedApplication().displayDialog_withTitle("Select at least one symbol instance to rename.","Symbol Instance Renamer"); + NSApplication.sharedApplication().displayDialog_withTitle(strRenameFailure,strPluginName); } } diff --git a/appcast.xml b/appcast.xml index bbb1203..68f5fea 100644 --- a/appcast.xml +++ b/appcast.xml @@ -6,15 +6,15 @@ Rename all symbol instances to the name of their master. en - Version 2.2 + Version 2.3 -
  • Added appcast plugin support for Sketch 45 and later. Added new function to rename all instances on current page.
  • +
  • Added new function to rename all instances on all pages, except Symbols page. Added fix for when the master for an instance is missing.
  • ]]>
    - +