Exported Application Troubles

edited April 2018 in Arduino

I have my code working well enough, but not I'm having troubles... implementing it. I can manually start my .exe by double-clicking it, but I can't open it through the command prompt or Windows Task Scheduler. Other applications (Notepad, Word, Processing) open through these channels, just not my Processing code exported as an executable file. Any idea if this problem stems from my code or anything Processing related? Here's the code if it helps:

import processing.serial.*;
import ddf.minim.*;

Minim minim;
AudioPlayer stand;
AudioPlayer sit;
AudioPlayer move;

int lf = 10; 
String myString = null;
Serial myPort;   
int sensorValue = 0;

void setup() {

  printArray(Serial.list());

  myPort = new Serial(this, Serial.list()[0], 9600);
  myPort.clear();

  myString = myPort.readStringUntil(lf);
  myString = null;

  minim = new Minim(this);

  stand = minim.loadFile("stand.mp3"); 
  sit = minim.loadFile("sit.mp3");
  move = minim.loadFile("move.mp3");
}

void draw() {

  while (myPort.available() > 0) {

    myString = myPort.readStringUntil(lf);

    if (myString != null) {
      myString = myString.trim();   

      if(myString.length() > 0) {
        println(myString);              
        }

      if(myString.equals("sit")){
            move.pause();
            stand.pause();
            sit.rewind();
            sit.play();

            if(sit.isPlaying() == true)  {
              println("Sound");
            }

        }        
      if(myString.equals("stand")){
            sit.pause();
            move.pause();
            stand.rewind();
            stand.play();

            if(stand.isPlaying() == true)  {
              println("Sound");
            }

        }        
      if(myString.equals("move")){
            stand.pause();
            sit.pause();
            move.rewind();
            move.play();

            if(move.isPlaying() == true)  {
              println("Sound");
            }

        }
      }
    }
  }
Tagged:

Answers

  • You might need to run it using a batch file. Or try this from:

    https://superuser.com/questions/876933/running-exe-in-command-prompt

    Command: start /b /w /D "C:\StartAndEnd\scripts"

    Just replace the exef ile with your file. Unfortunately I cannot do any testing at the moment. Let us know if it works for you.

    Kf

  • Ok, I checked on a Windows machine an exe file launches right from the command prompt. You can type start your_exe_file.exe (Assuming you cd to the directory containing the exe file) and it runs as well. Notice you do not need any of the flags I mentioned before. As a matter of fact, using those flags will not run the exe file (in short).

    Could you generate a simple sketch that doesn't access any resources, like your sample sound files, and that does not use external libs and confirm you still have a problem executing the exe files? The first thing I would check is if your exe file has access to your external sound files.

    Kf

  • Batch files don't work either. I loaded up the example AdditiveWave, which doesn't access any resources or use external libraries and I received the same results. The first time I attempt to open the exported .exe, whether manually, from cmd, or from a batch file, my antivirus scans it for malware, so I know it's targeting the correct file. It just won't run unless I manually start it, or if I place it in my computers startup file.

Sign In or Register to comment.