Popular JavaScript recipes tagged "macro"http://code.activestate.com/recipes/langs/javascript/tags/macro/2014-07-03T15:18:03-07:00ActiveState Code RecipesCSS line with px value adds a new line with rem (JavaScript)
2013-11-20T21:15:22-08:00Magnus Axelssonhttp://code.activestate.com/recipes/users/4188509/http://code.activestate.com/recipes/578769-css-line-with-px-value-adds-a-new-line-with-rem/
<p style="color: grey">
JavaScript
recipe 578769
by <a href="/recipes/users/4188509/">Magnus Axelsson</a>
(<a href="/recipes/tags/convert/">convert</a>, <a href="/recipes/tags/css/">css</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>).
</p>
<p>Put your cursor on a CSS line that ends with a value in px (do not select any text). Run the script and it will insert a new line there the px value is converted to a rem value. </p>
<p>You need to edit the code to modify your rem base matching the one you use in your own CSS. The default value is 16.</p>
<p>Example:
font-size: 12px; (run the script with the cursor in this line)
font-size: 0.75rem (new line added by script) </p>
Komodo JS Macro - show git blame for the current editor line (JavaScript)
2013-05-28T18:59:52-07:00Philip Cooperhttp://code.activestate.com/recipes/users/4168074/http://code.activestate.com/recipes/578537-komodo-js-macro-show-git-blame-for-the-current-edi/
<p style="color: grey">
JavaScript
recipe 578537
by <a href="/recipes/users/4168074/">Philip Cooper</a>
(<a href="/recipes/tags/blame/">blame</a>, <a href="/recipes/tags/git/">git</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scc/">scc</a>).
</p>
<p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can show the SCC repository information for who last changed the current line in the Komodo editor - see the screenshot below.</p>
<p><img src="http://community.activestate.com/files/images/svn_blame.png" alt="svn blame image" /></p>
Komodo JS macro: example chess match (JavaScript)
2012-10-24T16:59:51-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/578304-komodo-js-macro-example-chess-match/
<p style="color: grey">
JavaScript
recipe 578304
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/chess/">chess</a>, <a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>).
</p>
<p>This is an example macro that will play a specific chess game (Deep Blue v's Garry Kasparov) inside the Komodo editor.</p>
Komodo JS Macro -- Escape HTML Special Characters in current file (JavaScript)
2012-05-25T20:04:49-07:00Keegan Brownhttp://code.activestate.com/recipes/users/4182206/http://code.activestate.com/recipes/578146-komodo-js-macro-escape-html-special-characters-in-/
<p style="color: grey">
JavaScript
recipe 578146
by <a href="/recipes/users/4182206/">Keegan Brown</a>
(<a href="/recipes/tags/characters/">characters</a>, <a href="/recipes/tags/html/">html</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/special/">special</a>, <a href="/recipes/tags/xhtml/">xhtml</a>).
</p>
<p>Escapes all Special Characters to their HTML Special Character equivalent.</p>
Komodo JS Macro: Execute JavaScript (JavaScript)
2012-05-07T13:21:30-07:00Patrick Clokehttp://code.activestate.com/recipes/users/4180275/http://code.activestate.com/recipes/578120-komodo-js-macro-execute-javascript/
<p style="color: grey">
JavaScript
recipe 578120
by <a href="/recipes/users/4180275/">Patrick Cloke</a>
(<a href="/recipes/tags/debug/">debug</a>, <a href="/recipes/tags/debugging/">debugging</a>, <a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>).
</p>
<p>Executes a JavaScript file (or the selected text) and display the results in the command output window.</p>
Komodo JS Macro - Add CSS3 Prefixes (JavaScript)
2012-05-25T20:02:50-07:00Keegan Brownhttp://code.activestate.com/recipes/users/4182206/http://code.activestate.com/recipes/578145-komodo-js-macro-add-css3-prefixes/
<p style="color: grey">
JavaScript
recipe 578145
by <a href="/recipes/users/4182206/">Keegan Brown</a>
(<a href="/recipes/tags/css/">css</a>, <a href="/recipes/tags/macro/">macro</a>).
</p>
<p>Simple macro to add vendor prefixes to a CSS declaration under the cursor. Isn't smart and doesn't know what needs a prefix and what doesn't, just adds all the prefixes. </p>
Komodo JS Macro - Copy all "Find Results 1" data into a new editor window (JavaScript)
2014-07-03T15:18:03-07:00Dave Waldhttp://code.activestate.com/recipes/users/4181625/http://code.activestate.com/recipes/578100-komodo-js-macro-copy-all-find-results-1-data-into-/
<p style="color: grey">
JavaScript
recipe 578100
by <a href="/recipes/users/4181625/">Dave Wald</a>
(<a href="/recipes/tags/findresults/">findresults</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>).
Revision 5.
</p>
<p>Gets the Find Results Manager for the "Find Results 1" tab, if it exists.
If the tab has rows in it, then copies out all the data from each row and adds it to an output buffer.
Creates a new editor view (or optionally reuses the existing one) and appends the output buffer to it.
Note: Be sure to see Bruno's update below, until I get it merged in. ;)</p>
Komodo JS Macro: move tabs (JavaScript)
2012-04-10T17:39:47-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/578093-komodo-js-macro-move-tabs/
<p style="color: grey">
JavaScript
recipe 578093
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/position/">position</a>, <a href="/recipes/tags/tabs/">tabs</a>, <a href="/recipes/tags/toddw/">toddw</a>).
</p>
<p>This Komodo macro is an example to show how to programmatically re-position a Komodo editor tab. This macro moves the currently selected tab to the start of the tab list.</p>
Komodo JS Macro: Real auto word-wrap (JavaScript)
2012-04-10T17:38:13-07:00Furlohttp://code.activestate.com/recipes/users/4180513/http://code.activestate.com/recipes/578099-komodo-js-macro-real-auto-word-wrap/
<p style="color: grey">
JavaScript
recipe 578099
by <a href="/recipes/users/4180513/">Furlo</a>
(<a href="/recipes/tags/auto/">auto</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/word/">word</a>, <a href="/recipes/tags/wrap/">wrap</a>).
</p>
<p>This script will add real auto-wrap functionality to Komodo, ie. it will wrap text after reaching column 80 just in the same way as you would by pressing <Enter>.</p>
<p>You can bind a keyboard shortcut to macro, or trigger it on Komodo startup, or both. Either way, repeated pressing of binded shortcut (or running the macro) will switch it off and on again.</p>
<p>In fact, script only adds event listener, which fires a function (after each keypress), that checks if cursor position is not in column higher that 79 and, if needed, calls Komodo built-in function "Reflow paragraph" to reflow the paragraph.</p>
<p>This recipe was not created by me from scratch. I have just read David Brewer's feature request at <a href="http://code.activestate.com/lists/komodo-discuss/4965/">komodo-discuss</a>, used <a href="http://www.openkomodo.com/blogs/troyt/revenge-auto-wrap-type-type-type-ding">troyt's original code</a> for autowrap and tweaked/simplified it a little.</p>
Komodo Macro: stop leaving indented blank lines when you press enter (JavaScript)
2012-03-09T19:28:31-08:00Raymond Butcherhttp://code.activestate.com/recipes/users/4181141/http://code.activestate.com/recipes/578068-komodo-macro-stop-leaving-indented-blank-lines-whe/
<p style="color: grey">
JavaScript
recipe 578068
by <a href="/recipes/users/4181141/">Raymond Butcher</a>
(<a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>).
</p>
<p>When your cursor is at the end of an indented blank line, and you press the enter key, this macro will catch that keypress and insert an empty new line above the current line. This pushes your indented line down, and you can keep coding as normal. It is quite seamless; the only difference is that you have not left any whitespace in your wake.</p>
<p>This makes it easier to follow the Python PEP-8 style guide, but it's not limited to Python code.</p>
Macro to Quick find (ctrl+f3) on double click (JavaScript)
2011-07-22T07:46:26-07:00Adamhttp://code.activestate.com/recipes/users/4173315/http://code.activestate.com/recipes/577801-macro-to-quick-find-ctrlf3-on-double-click/
<p style="color: grey">
JavaScript
recipe 577801
by <a href="/recipes/users/4173315/">Adam</a>
(<a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scintilla/">scintilla</a>).
Revision 3.
</p>
<p>This does a search for the selected word when you double click it. Functionality similar to Notepad++. Faster that ctrl-f3.</p>
Komodo JS Macro: smart quotes and smart braces (JavaScript)
2013-06-24T13:38:55-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577790-komodo-js-macro-smart-quotes-and-smart-braces/
<p style="color: grey">
JavaScript
recipe 577790
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/braces/">braces</a>, <a href="/recipes/tags/brackets/">brackets</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scintilla/">scintilla</a>, <a href="/recipes/tags/smart/">smart</a>, <a href="/recipes/tags/toddw/">toddw</a>).
Revision 5.
</p>
<p>With this macro, you can make a text/word selection, then press one of ", ', (, [ or { and the matching set of quotes/braces will be added around the selection.</p>
<p>Example (where | denotes the selection):
This is |myselectedword|.
then pressing "{" you'll get:
This is {myselectedword}.</p>
Komodo JS Macro: colorize the output console with a different color scheme (JavaScript)
2011-06-24T17:52:48-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577770-komodo-js-macro-colorize-the-output-console-with-a/
<p style="color: grey">
JavaScript
recipe 577770
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scintilla/">scintilla</a>, <a href="/recipes/tags/toddw/">toddw</a>).
</p>
<p>It's possible to colorize any Scintilla based widget (the editor part) in Komodo using a color scheme. In Komodo there is the "Fonts and Color" preferences that get applied to all scintilla widgets, but you can manually change individual scintilla widgets as you wish.</p>
<p>This macro changes the color scheme of the Command Output tab to use the "Dark" scheme.</p>
Komodo JavaScript Macro - wrap the current word under the cursor (JavaScript)
2011-02-02T23:28:37-08:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577561-komodo-javascript-macro-wrap-the-current-word-unde/
<p style="color: grey">
JavaScript
recipe 577561
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/text/">text</a>, <a href="/recipes/tags/toddw/">toddw</a>, <a href="/recipes/tags/wrap/">wrap</a>).
</p>
<p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can be used to wrap the current word under the cursor position (or current selection) with arbitrary text.</p>
<p>For example, if I'm editing a HTML file and have the selected text "This is my heading", I can quickly use this macro to wrap this text into "<h1>This is my heading</h1>".</p>
A Template for Crash-Resistant Toggle-Macros (JavaScript)
2010-10-07T00:51:42-07:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577418-a-template-for-crash-resistant-toggle-macros/
<p style="color: grey">
JavaScript
recipe 577418
by <a href="/recipes/users/4166930/">Eric Promislow</a>
(<a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/snippet/">snippet</a>, <a href="/recipes/tags/template/">template</a>).
</p>
<p>If you've followed my postings here lately (<a href="http://code.activestate.com/recipes/users/4166930/" rel="nofollow">http://code.activestate.com/recipes/users/4166930/</a>), you'll see that I've been playing with what I call "toggle macros", macros that toggle a state on and off, with different behaviors for each state. Unfortunately I found that it was easy to get Komodo to crash on shutdown. Meanwhile I wanted to build a framework to make it easier to build these.</p>
<p>This recipe accomplishes both. It looks like putting a listener on a view object can trigger this crash, but so can storing a method on a view object, even with a unique name.
So while I wanted to use the "view.view_closing" event, I can't, and I notice no other core Komodo code is. The template instead uses a global hash, ko.extensions.togglers,
to store the code objects. And now I'm not getting a crash.</p>
Komodo JS Macro - use vertical editor tabs positioned to the right (JavaScript)
2010-09-10T02:53:33-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577386-komodo-js-macro-use-vertical-editor-tabs-positione/
<p style="color: grey">
JavaScript
recipe 577386
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/layout/">layout</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/tab/">tab</a>).
</p>
<p>A <a href="http://www.activestate.com/komodo-ide">Komodo</a> JavaScript macro that can be used to position the editor tabs on the right side and shown vertically.</p>
<p>Additional layouts (left, right, up, down, vertical, horizontal) can be made with different combinations, see here for the Mozilla tabbox positioning documentation:
<a href="https://developer.mozilla.org/en/XUL_Tutorial/Tabboxes#Position_of_the_tabs" rel="nofollow">https://developer.mozilla.org/en/XUL_Tutorial/Tabboxes#Position_of_the_tabs</a></p>
Komodo JS Macro - insert a relative path from the current editor file (JavaScript)
2012-02-24T00:23:09-08:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577306-komodo-js-macro-insert-a-relative-path-from-the-cu/
<p style="color: grey">
JavaScript
recipe 577306
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/path/">path</a>, <a href="/recipes/tags/relative/">relative</a>).
Revision 3.
</p>
<p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can be used to generate a relative path from the current editor file location, which works great for HTML when linking to relative style sheets, images, etc...</p>
<p>Upon execution of this macro, you will be prompted to browse and select the target file, then upon selecting the target path, the relative path location will be inserted into the editor at the current position.</p>
<p>To best use this macro - assign a custom key-binding to the macro and then trigger the macro at will.</p>
Komodo Macro: Show all Bookmarks (JavaScript)
2013-04-09T16:45:53-07:00Troy Topnikhttp://code.activestate.com/recipes/users/4165698/http://code.activestate.com/recipes/577272-komodo-macro-show-all-bookmarks/
<p style="color: grey">
JavaScript
recipe 577272
by <a href="/recipes/users/4165698/">Troy Topnik</a>
(<a href="/recipes/tags/bookmarks/">bookmarks</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>).
Revision 5.
</p>
<p>Komodo JavaScript macro that shows a click-able list of all bookmarks in the Command Output tab.</p>
Komodo Macro - Copy to clipboard code selection in HTML format (JavaScript)
2010-04-14T07:17:59-07:00Davide Ficanohttp://code.activestate.com/recipes/users/4166571/http://code.activestate.com/recipes/577193-komodo-macro-copy-to-clipboard-code-selection-in-h/
<p style="color: grey">
JavaScript
recipe 577193
by <a href="/recipes/users/4166571/">Davide Ficano</a>
(<a href="/recipes/tags/clipboard/">clipboard</a>, <a href="/recipes/tags/html/">html</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>).
</p>
<p>This macro makes easy to paste on documents (MS Office, Open Office, iWorks Pages) code snippets with syntax highlight and/or line numbers.</p>
<p>This macro copies the selected code text or whole document if no selection is present on clipboard in HTML format.</p>
<p>On OSX you need at least Komodo 6 because previous versions don't support data flavors</p>
Komodo JS Macro - Submit text selection to pastebin.mozilla.com service (JavaScript)
2010-03-31T06:34:21-07:00Davide Ficanohttp://code.activestate.com/recipes/users/4166571/http://code.activestate.com/recipes/577170-komodo-js-macro-submit-text-selection-to-pastebinm/
<p style="color: grey">
JavaScript
recipe 577170
by <a href="/recipes/users/4166571/">Davide Ficano</a>
(<a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/pastebin/">pastebin</a>).
</p>
<p>Submit the select text to pastebin and copy to clipboard the URL returned from service.</p>
<p>The programming language is auto-detected.</p>
<p>The statusbar will show the message about submission status.</p>
<p><strong>Setting username</strong></p>
<p>By default the post is submitted with 'anonymous' user, to change it set the <strong>nick</strong> variable to a different value </p>