Difference between revisions of "Clipboard Commands"

From OpenCircuits
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 17: Line 17:
 
</pre>
 
</pre>
  
then the *>cmd button will open all 4 url's.  This lets you keep a list of links in any file that can store text.
+
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.
  
 
== Manual/Auto ==
 
== Manual/Auto ==
  
* Press the *>cmd button to interperte the clipped text as a command.
+
* 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 interperted 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.
+
* 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 =  
 
= Command Details =  
Line 48: Line 48:
  
 
== *>bat ==
 
== *>bat ==
 +
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:
 +
  
 +
*>bat
 +
        dir c:
 +
*>end
 
   
 
   
 +
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'''
 +
 +
== *>py ==
  
 +
Not implemented, planed to be like *>bat but for Python code.
  
+
= Customization =
  
 +
Writing your own Commands is more complicated than I want to document now.  Code is in cmd_processor.py
  
  
 
[[Category:ClipBoard]]  [[category:Python]]  [[category:Python Projects]]
 
[[Category:ClipBoard]]  [[category:Python]]  [[category:Python Projects]]

Latest revision as of 09:54, 20 March 2020

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

Overview[edit]

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:

        *>url  https://southcoast.craigslist.org/
    https://southcoast.craigslist.org/tls/d/new-bedford-delta-table-saw/7090239741.html
        *>url  https://southcoast.craigslist.org/tls/d/new-bedford-delta-table-saw/7090239741.html
    Manure - farm & garden - by owner - sale
        *>url  https://southcoast.craigslist.org/grd/d/lakeville-manure/7080232396.html
    The 50 TV Shows You Need to Watch This Winter - The New York Times
        *>url  https://www.nytimes.com/2020/01/02/arts/television/50-shows-to-watch.html?0p19G=0038

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.

Manual/Auto[edit]

  • 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]

*>url[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().

*>text[edit]

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

*>shell[edit]

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

*>bat[edit]

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:


*>bat
       dir c:
*>end

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

*>py[edit]

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

Customization[edit]

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