Clipboard Commands

From OpenCircuits
Jump to navigation Jump to search

This is a guide to the "Command" functions in my Python Clipboard Application, the root documentation is at: Python Smart ClipBoard


Commands are text, single of multiline that contain a command. This is typically indicated by a line starting with *>. Some commands are *>url and *>bat. Some commands are basically single line commands, but you can copy multiple lines with multiple commands ( of the same kind ) or some like *>bat are inherently multi line and currently you can only execute one in a single copy.

For a bit of context if you have the following in your clipboard:

    Manure - farm & garden - by owner - sale
    The 50 TV Shows You Need to Watch This Winter - The New York Times

then the press the <*>cmd> button and the application will open all 4 url's in your systems default browser. This lets you keep a list of links in any file that can store text.


  • Press the *>cmd button to interpret the clipped text as a command.
  • Depress the radio button <always on> and each new clipboard change will be interpreted as a command, but a general rule is that a command must be found in the first line, so unless this is true the command button acts as if it were not on, the same is true when you press the command button.

Command Details[edit]


This command will open a url that follows the *>url. If multiple lines contain the command many urls will be opened. One restriction is that the first line copied must contain a *>url command. Following lines in the clipboard that do not contain the command are just ignored. Most webbrowsers can copy out the titles and urls of an open page or all open tabs. If this is copied into the clipboard the transform "add *>url" will add the command to each url ( one per line ) found. The transform can then be save for later use as a command.

The code for the command is mostly in cmd_processor.do_star_url_line().


The *>text command is used to open text files. The command needs to be followed by the name of a file that can be opened with your system editor ( the key parameter is paremeters.ex_editor see Configuration Files For Python ) You can have multiple *>text commands in your clipped content, only lines with *>text will be attempted, other lines will be ignored. Files are not currently tested to see if they exist, non-existent files may trigger side effects in your editor. The content returned to the clipboard is all the lines that were identified as *>text lines. Junk after the file name will be interperted as part of the file name, so leave it out of your file, this goes for spaces as well ( but I probably will fix this. As with *>url the first line of the copied text must contain a command.

There is a transform for adding *>text in front of lines of file names.

The code for the command is mostly in cmd_processor.do_star_text_line


The command *>shell followed by a string your operating system recognizes a command in your os terminal shell will run that string. Like *>url and *>text it can work for multiple commands across multiple lines.

My file explorer in windows does a nice job of copying one or multiple file names ( program is called FreeCommander ), the transform

The code for the command is mostly in cmd_processor.do_star_text_line


The *>bat command allows you to execute windows dos batch commands from text stored anywhere you can copy from. These commands are inherently multilined. For example:

       dir c:

The above command will fill the clipboard with the result from the directory of c:

Because the command is multilined it needs some sort of end marker. This is *>end


Not implemented, planed to be like *>bat but for Python code.


Writing your own Commands is more complicated than I want to document now. Code is in