PPTools/Guiguts/Guiguts Manual/Custom Menu

From DPWiki
Jump to navigation Jump to search


GUIGUTS VERSION 1.4.0 MANUAL

External Programs

The Custom Menu

Gg1.2-50a-custommenu.png

is entirely under your control, and lets you run programs and web tools that are beyond Guiguts' scope. The list above is the default one, but you are likely to add, delete, and rearrange it as time goes by.

Customizing the Custom Menu

(That's why it's named that way.)

To configure the menu, click Custom>Set External Programs. The following large dialog opens:

Gg1.2-50b-custom set external programs.png

Each row of the table corresponds to one Custom menu choice. The text of the menu item is on the left, and the command to execute is on the right.

Initially, there are some empty rows at the bottom for your use. If you fill all of them and need more space, click OK and then click Custom>Set External Programs again; more empty rows will appear. There's no upper limit to the number of rows you can use, but at some point, the dialog's height will exceed what your screen can show, and the "OK" button will be off-screen. If that happens, decrease the dialog's height by dragging the top edge down, then drag the entire dialog window up (and consider removing some entries; Guiguts will reduce the number of blank rows next time you open this dialog).

Instructions for composing commands are shown at the top: you can use symbols that Guiguts will replace with file names or file paths:

$d The full path to the current document
$f The filename of the current document
$e The file extension including the dot (e.g. .txt) of the current document; thus $f$e is replaced by the complete filename, and $d$f$e represents the filename with its path.
$i The full path to the page-image directory
$p The page-image number currently shown in the status bar; thus $p.png would be the page-image filename and $i$p.png the image with its full path.

Windows Commands

The first part of an external command must specify an executable program. You can do this by spelling out the full path, for example "C:\Program Files\XnView\xnview.exe" (quotes are needed because of the space in "Program Files"). However, you can often use the generic command start to avoid having to learn and code the full path to a command. The start command can open any file or URL in its default handler. The command can be used in the following ways:

start url Open url in default browser:
start http://validator.w3.org/
start file Open file in the handler for its file extension: start $d$f$e opens current file in default handler, e.g. Notepad for .txt.
start cmd parameters Start registered program cmd passing it the parameters: start wordpad $d$f$e opens wordpad passing it the full path of the current file.

If Chrome is your default browser, but you want to see how the document looks in Firefox:

View in Firefox start firefox "$d$f$e"

Linux and OS X Commands

The first part of an external command must specify an executable program. You can do this by spelling out the full path, for example /dp/viewer/xnview or /usr/bin/qiv.

You do not need to specify the full path for programs that are located in directories listed in your $PATH variable, for example programs in /usr/bin. Test this with the which command in a terminal window. If which command produces a positive response, you can use command without specifying its full path.

In OS X and at least some Linux systems, you can use the generic command open to launch a URL or file in its default handler. In OS X the command has these forms:

open url Open url in default browser: open http://validator.w3.org/
open file Open file in the handler for its file extension: open $d$f$e opens current file in the default handler, e.g. TextEdit for .txt in OS X.
open -a cmd parameters Start application cmd passing it the parameters: open -a bbedit $d$f$e, open -a preview $i$p.png, or open -a firefox $d$f$e

If you are using Linux, check to see if you have a command named open, and read its man page (man 1 open) to see how to use it. If your Linux does not have such a command, you need to use specific command names.