- About Us
#!/bin/bash if [ -x sylpheed-claws-gtk2 ] then sylpheed-claws-gtk2 --compose --attach $* fi
Nautilus Scripts are run in the shell. All scripts start with a line that tells the shell which program to use to run the script. In this case, the script should be run using the bash shell.
The next line is a test to see if the program you want to run is installed and executable. If the program is not detected, or is detected but is not executable, then the call to Sylpheed-Claws will not be made.
Then comes the command to open Sylpheed-Claws with parameters that instruct it to compose a new email message and add all the files selected in Nautilus as attachments. The
$* argument expands to a list of all the file names passed to the shell from Nautilus.
The paths of the files you have selected are passed to the script so that it can perform its tasks on those files. If you use a script while browsing a remote server, such as a Windows share or an FTP file system, the paths to the files you select are not passed to the script, but Nautilus sets these Environment variables, which can be used by the script:
This script will attach only local files to the new email message.
This script does not populate your Send To field with any email addresses; you have to do that manually. It could, however, be extended to ask you for the email address of the person you want to send the files to and then send the message and its attachments to that person automatically. Obviously, you can do many more things with scripts, but this simple example demonstrates that you don't need a degree in computer science to get something simple happening.Next: Nautilus Extensions