Home Download Buy Blog Forum Support

Macro Help

Macro Help

Postby TeamDman on Thu Feb 28, 2013 1:46 am

I am trying to make a macro to copy the contents of the current file, open a new one, paste the contents, apply a ROT-13 , copy the result of that, and close the created file

The problem I am having is creating the new file and closing it when I am done.
This is what I have so far :

[
{
"args": null,
"command": "select_all"
},
{
"args": null,
"command": "copy"
},
{
"args": null,
"command": "new_window"
},
{
"args": null,
"command": "paste"
},
{
"args": null,
"command": "select_all"
},
{
"args": null,
"command": "rot13"
},
{
"args": null,
"command": "copy"
},
{
"args": null,
"command": "close_file"
},
]
TeamDman
 
Posts: 4
Joined: Thu Feb 28, 2013 1:43 am

Re: Macro Help

Postby hryx on Sat Mar 02, 2013 10:05 pm

Hi there,

I'm very new to Sublime Text commands (and was sad to discover that the documentation is incomplete/inaccurate), but this should help.

If your goal is to copy all ROT-13'd text to clipboard and leave the source text untouched, there's no reason to create a new window. Simply ROT-13 it, copy it, then ROT-13 it again.

Code: Select all
[
   {
      "command": "select_all",
      "args": null
   },
   {
      "command": "rot13",
      "args": null
   },
   {
      "command": "copy",
      "args": null
   },
   {
      "command": "rot13",
      "args": null
   }
]


Save as e.g. rot13copyall.sublime-macro in Packages/User. Works for me in Sublime Text 2. Current v3 beta (build 3012) seems to have broken ROT-13.
hryx
 
Posts: 4
Joined: Sat Mar 02, 2013 9:55 pm

Re: Macro Help

Postby TeamDman on Sun Mar 03, 2013 8:01 pm

Thank you I forgot that ROT-13 can do that.
TeamDman
 
Posts: 4
Joined: Thu Feb 28, 2013 1:43 am

Re: Macro Help

Postby TeamDman on Sun Mar 03, 2013 9:54 pm

Would it be possible to make it return to the line it was at before the macro was ran?
TeamDman
 
Posts: 4
Joined: Thu Feb 28, 2013 1:43 am


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 31 guests