open() \ Language (API) \ Processing 1.0
Language (A-Z) \
Libraries \
Tools \
Environment
Reference for Processing version 1.2. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know.
If you prefer a more technical reference, visit the Processing Javadoc.
Name
open()
Examples
void setup() {
size(200, 200);
}
void draw() {
// draw() must be present for mousePressed() to work
}
void mousePressed() {
println("Opening Process_4");
open("/Applications/Process_4.app");
}void setup() {
size(200, 200);
}
void draw() {
// draw() must be present for mousePressed() to work
}
void mousePressed() {
String[] params = { "/usr/bin/jikes", "-help" };
open(params);
}
Description
Attempts to open an application or file using your platform's launcher. The file parameter is a String specifying the file name and location. The location parameter must be a full path name, or the name of an executable in the system's PATH. In most cases, using a full path is the best option, rather than relying on the system PATH. Be sure to make the file executable before attempting to open it (chmod +x).
The args parameter is a String or String array which is passed to the command line. If you have multiple parameters, e.g. an application and a document, or a command with multiple switches, use the version that takes a String array, and place each individual item in a separate element.
If args is a String (not an array), then it can only be a single file or application with no parameters. It's not the same as executing that String using a shell. For instance, open("jikes -help") will not work properly.
This function behaves differently on each platform. On Windows, the parameters are sent to the Windows shell via "cmd /c". On Mac OS X, the "open" command is used (type "man open" in Terminal.app for documentation). On Linux, it first tries gnome-open, then kde-open, but if neither are available, it sends the command to the shell without any alterations.
For users familiar with Java, this is not quite the same as Runtime.exec(), because the launcher command is prepended. Instead, the exec(String[]) function is a shortcut for Runtime.getRuntime.exec(String[]).
Syntax
open(file)
open(args)
Parameters
file
String: name of the file
args
String[]: list of commands passed to the command line
Returns
None or Process
Usage
Application
Updated on June 14, 2010 12:05:29pm EDT
Processing was initiated by Ben Fry and Casey Reas. It is developed by a small team of volunteers.
© Info \
Site hosted by Media Temple!
Wyszukiwarka
Podobne podstrony:
open c (3)openNie wspierajcie ekumenicznej organizacji Open Doors!function dbase openfunction proc openopen new window2004 11 Porównanie serwerów relacyjnych baz danych Open Source [Bazy Danych]function pdf open giffunction cpdf openSIL Open Font License 1 1function pdf open image fileopenfunction dbplus open2 Omowienie pakietu MS Office i Open Office Ogolne wlasciwosci?ytora tekstuDr Dre Got Me OpenSnow Patrol Hands Openwięcej podobnych podstron