Hi all I wonder if anyone can help me solve this small issue I'm having. I have set up a piece of code which transfers a scanned document to a folder. I would like for this file to exist only for the duration of time that the program is open for. After the program shuts, I would like to delete this file. It is only temporary. I'd like to introduce some conditionals to the part of the code which reads:
File f1 = new File("C:/Users/arthur prior/Desktop/OUTPUT/" + "%TEMP%PRESCAN" + "." + FILETYPE.captionLabel());
f1.delete();
something like
if "the program has closed" {
File f1 = new File("C:/Users/arthur prior/Desktop/OUTPUT/" + "%TEMP%PRESCAN" + "." + FILETYPE.captionLabel());
f1.delete()
}
In a way it is a chicken and egg situation, because if the program has terminated then it will not be able to fulfil my request to delete the file...
Any help would be greatly appreciated! Regards, Arthur
Hi all I wonder if anyone can help me. I am writing a program which interfaces with a scanner. I would like to have a secondary window which displays the images as they are scanned. I am using the control p5 library, specifically, the pApplet as a secondary window. the trouble I'm having is that the pApplet stuff is setup right before Void Setup. That's all very well, but I have asked "theApplet" to load up an image using variables which are yet to be established. for example the file name and file extension are given by a textfield. Is there a simpler method of going about what I am trying to achieve or can I pull it off this way?
// controlWindowCanvas class
class MyCanvas extends ControlWindowCanvas {
public PImage P;
public MyCanvas() {
P = loadImage("C:/Users/arthur prior/Desktop/OUTPUT/" +MARGINmyTextfield.getText() + "." + FILETYPE.captionLabel());
}
public void draw(PApplet theApplet) {
theApplet.image(P,0,0);
}
}
I'll also post the whole code so you can see what's going on elsehwhere...
import processing.opengl.*;
import javax.imageio.ImageIO;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import processing.serial.*;
import controlP5.*;
ControlP5 controlP5;
Serial port;
Textfield MARGINmyTextfield;
ListBox RESOLUTION;
ListBox FILETYPE;
ControlWindow controlWindow;
ControlWindowCanvas cc;
// controlWindowCanvas class
class MyCanvas extends ControlWindowCanvas {
public PImage P;
public MyCanvas() {
P = loadImage("C:/Users/arthur prior/Desktop/OUTPUT/" +MARGINmyTextfield.getText() + "." + FILETYPE.captionLabel());
}
public void draw(PApplet theApplet) {
theApplet.image(P,0,0);
}
}
void setup() {
size(420, 594);
frame.setLocation(0,0); // set to the position of the second display
controlP5 = new ControlP5(this); // initialize the GUI controls
for some reason when I open a PImage, it doesn't open a new window. Instead, it opens as a background to the main canvas. I would really appreciate it if anyone could tell me what I am doing wrong so that I can do it right
MorenaImage morenaImage = new MorenaImage(source);
I hope someone has an answer I'm losing faith! Of course I have made an assumption that a new PImage should open in a new window but this is the case in example upon which I have based my sketch
Hi all. I'm trying to use the 'listbox' in the controlP5 library. My issue is the I want to select an item from the listbox and use it to determine a value.
RESOLUTION.valueLabel().style().marginTop = 3; // the +/- sign
RESOLUTION.addItem("72",1);
RESOLUTION.addItem("150",1);
RESOLUTION.addItem("240",1);
RESOLUTION.addItem("300",1);
RESOLUTION.addItem("360",1);
RESOLUTION.addItem("400",1);
RESOLUTION.addItem("600",1);
RESOLUTION.addItem("720",1);
RESOLUTION.addItem("800",1);
RESOLUTION.addItem("1200",1);
RESOLUTION.addItem("2400",1);
RESOLUTION.addItem("3200",1);
RESOLUTION.addItem("4800",1);
RESOLUTION.addItem("6400",1);
RESOLUTION.addItem("9600",1);
RESOLUTION.addItem("12800",1);
RESOLUTION.setColorBackground(color(255,128));
RESOLUTION.setColorActive(color(0,0,255,128));
//////////////////////////////////////////////
double resolution = Double.parseDouble(WHAT DO I TYPE HERE TO GET THE VALUE FROM THE LISTBOX???); //////////////////////////////////////////////////////////// <----- THE PROBLEMATIC PART OF THE CODE
My question is how do I retrieve the value from the listbox? I was thinking something along the lines of "RESOLUTION.stringValue()" but this doesn't seem to work.
The bit "source.setResolution( );" likes 'doubles' so I need to convert the string from the listbox into a double using "parsedouble". Is this correct? Is the output from the listbox a string?
Hi all I'm trying to figure out a way to disable the key "enter". I'm using the controlP5 library and in it, there is a method called:
disableKeys()
It's a petty point, but I cant figure it out for the life of me! I'd really appreciate and suggestions as to how I can use it and where in the code I should put it. Otherwise, is there a method which is not specific to the control P5 library which I can use in Processing?
HI everyone I have been scouring the internet for a solution but I can't manage to find a solution to the problem.
What I am trying to achieve is to send a signal from Processing (using the ControlP5 library) to an arduino board to control the speed of a stepper motor. For simplicity sake, lets imagine I'm trying to dim an LED (I will use the same pin to control the PUL of my motor).
What I am trying to achieve is a piece of code which loads a program, waits for the program to load before sending keystrokes to perform certain actions. I want to be able to load photoshop and do stuff in it before saving the file. at the moment im using the delay() function, however this is unreliable as the amount of time the program takes to load varies depending on how busy my computer is. this is the current code (i am using the robotclass library):
Hello I wondered if anyone would be interested in taking a commission to write a program using processing.
The program should be quite straight forward for all you cHipsters.
The graphic interface should communicate with arduino to propel two stepper motors. The microprocessor is a Arduino Uno which connects to two microstepping drivers. The stepper motors are bipolar NEMA 23's. The design will need to have two tabs.
1. a simple 4 button interface which instructs the motor to move forward, backwards, left and right AT A SET DISTANCE OF 29.5 cm. The motor should increase speed and decrease up to its destination.
2 the second tab should allow me to propel the motors manually. again forward, backwards left and right buttons would be required.
If you think you are up to it and would be interested in taking this project on, then please email
arthur.prior@me.com or call 07828 059 474 (UK) to discuss the project further and to discuss a fee.