Geography Reference
In-Depth Information
Creating the Action
In our example, we are going to use the name of the city and pass
it to Google. The application we need is a web browser. In this case,
we will use Firefox. The URL to search for something with Google is
http://google.com/search?q=find_me , where find_me is the search term.
Attribute actions work by replacing specific strings in our argument
list with the values from the attribute table. The format of these strings
is simple—it's a percent sign (%) followed by the name of the field we
want to use. In our example, we therefore need to use %NAME as the
replaceable parameter. Putting this altogether gives us the following
action:
firefox http://google.com/search?q=%NAME
One important thing to note here—the browser must be in our path. If
not, the action will fail. The alternative and perhaps the safe way is to
fully specify the path to the browser:
/usr/bin/firefox http://google.com/search?q=%NAME
If you have spaces or other oddities you need to specify in the action,
use double quotes around the entire thing. They will be ignored when
the action is executed but safely allow you to specify the path and other
exotic parameters.
So now that we have the text for the action figured out, let's put it all
together to create and use the action. First open the properties dialog
box for the cities layer and click the Actions tab. Give the action a name,
“Google search” will work, and then enter the text of the action. If you
are following along, make sure to adjust the path for your browser.
Click the Insert Action button to add the action to the list. We could go
ahead and create other named actions in the same way. If you make a
mistake, you can click the action in the list and edit it.
When you are finished, click the Update action button to save your
changes. Notice we didn't use the Insert Field button and its associated
drop-down list of field names. That's because we determined before-
hand we were using %NAME. Also notice the browse button to the right
of the action text box. If you click this button, it lets you browse to the
location of the application you want to use to execute the action. In
our example, we could have used it to browse to the location of Firefox
( /usr/bin/firefox ). This is useful if you aren't sure of the full path for the
application needed to execute the action.
To complete the creation of the action, click OK. It's now ready to use.
 
Search WWH ::




Custom Search