We are about to switch to a new forum software. Until then we have removed the registration on this forum.
boolean overLeftButton = false;
boolean overRightButton = false;
void setup() {
size(200, 200);
}
void draw() {
background(204);
// Left buttom
if (overLeftButton == true) {
fill(255);
} else {
noFill();
}
rect(20, 60, 75, 75);
rect(50, 90, 15, 15);
// Right button
if (overRightButton == true) {
fill(255);
} else {
noFill();
}
rect(105, 60, 75, 75);
line(135, 105, 155, 85);
line(140, 85, 155, 85);
line(155, 85, 155, 100);
}
void mousePressed() {
if (overLeftButton) {
link("http:" + "//www.processing.org");
} else if (overRightButton) {
link("http:" + "//www.processing.org", "_new");
}
}
void mouseMoved() {
checkButtons();
}
void mouseDragged() {
checkButtons();
}
void checkButtons() {
if (mouseX > 20 && mouseX < 95 && mouseY > 60 && mouseY < 135) {
overLeftButton = true;
} else if (mouseX > 105 && mouseX < 180 && mouseY > 60 && mouseY <135) {
overRightButton = true;
} else {
overLeftButton = overRightButton = false;
}
}
Answers
There is no clear shell commands from my pc telling it to open my browser nor any class or code saying anything remotely "here open this page" i seen code that does this type of action and is far more complex/detail in its approach.
lines 24 and 36, link()
it's not in the reference but a quick search of the forum brings up this, which suggests it used to exist:
https://forum.processing.org/one/topic/link-opening-hundreds-of-web-pages.html
right so if it used to exist how is it still working ? does this mean i can use this link() to call searches online ? i try using
link("http:" + "//www.google.com", "_processing");
hoping i would open up a page with the processing search already performed but nothing just straight to google.Which version of processing are you running? I'm running 3.0.1 and I get an error saying the method link(String) isn't applicable for the arguments (String, String), referring to line 36.
i'm guessing it still exists in the code but is no longer in the reference.
the second argument to the call isn't defined anywhere but i doubt you can just put _processing in there. _new feels like a reserved word
try
link() is used in one of the examples
https://processing.org/examples/embeddedlinks.html
no i get what you guys are saying, and no
_new
is not a reserved syntax else i would have had an error when i ran the code. and thelink("https:" + "//www.google.co.uk/search?q=site:processing.org+" + keyword);
will work because your telling it explicitly where to go to if you was to paste that in any browser you would get directed to where the link says the thing was to make a variable with many diff addresses or even better to use the sound library to have the mic input the word you want to search and that will get placed in the constructor to that '_new" and now when you run the code it will work with that new word capture by the mic which will already have had a variable store in the globalAFaIK, link() always existed even as far back as Processing 1.5.1.
We can still see its web reference from pJS site: http://ProcessingJS.org/reference/link_/
Some forum threads w/ link() tag: https://forum.Processing.org/two/discussions/tagged?Tag=link()
P.S.: I've tried out to include links() in p5.js lib. Unfortunately it was refused w/ prejudice: X(
https://GitHub.com/processing/p5.js/pull/532
hmmm thats funny
prejudice
so theres no way to make use of that
link("http:" + "//www.google.com", "_processing");
? for search queryYes, prejudice! B/c not only in that particular time, but all times, she had sided w/ the JS side in all matters.
There wasn't even a single time where she had favored Processing's familiarity when a JS-sided voice was raised!
BtW, there ain't 1 Processing side voice there for years. I was the only 1. [-(
Chrisir thanks for the effort but this is not using any variables to call on a query, this is doing the same thing that
koogs
already suggested, what we needed was a way to set a variablevar/int/char/string = Tomatoes; //what ever lol
then use that variable to change its search when place in thelink("https:"+"//www.google.com/search?q="+VARIABLE HERE);
This variable will change according to the input from the microphone and its input then will be stored in the variable
can you grab the input from the microphone and turn it into text?
yes, im using arduino for the HW setup and serial to tx to processing i can even use visual studio to do this using the speech engine in the pc as well
parsing XML files
with preloaded data is another techniquethanks Chrisir! when i finish i the entire setup ill post here to share with the community
Thank you, Jai!