Processing 3.0 launch function doesn't launch my .exe.
I am using the Launch() function (https://processing.org/reference/launch_.html)
launch("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe");
Or
launch("C:/app/keyboard.exe");
Result: Chrome browser will open. keyboard.exe will not. I've tryed different locations and relative paths.
I only get a windows loader when the link is correct. So that is correct.
The function discriptions says this:
"Be sure to make the file executable before attempting to open it (chmod +x). "
https://superuser.com/questions/106181/equivalent-of-chmod-to-change-file-permissions-in-windows
I also made a .bat file to execute the .exe but the launch() function only works on exe files.
but that didnt work either.
System:
Processing 3.0
Java 8
Windows 10, 64 bit
So what am I missing?
It is a bit dodgy but works in windows 8:
PrintWriter output=null;
output = createWriter("myfile.bat");
output.println("cd "+sketchPath(""));
output.println("start archivo.exe");
output.flush();
output.close();
output=null;
launch(sketchPath("")+"myfile.bat");
And you can choose another relative or absolute path
for instance
output.println("cd ..");
output.println("cd directoriy");
...
As Samuil advises, Windows uses \ instead of a / as a separator character, which you'll need to escape, hence \\: launch("C:\\app\\keyboard.exe");
I recommend using File.separator:
launch("C:"+File.separator+"app"+File.separator+"keyboard.exe");
It's a bit longer, but will work regardless of the operating system(Linux/OSX/Windows/etc.).
Aside launch(), also try exec():
exec(new String[]{"start","C:"+File.separator+"app"+File.separator+"keyboard.exe");
also Process. (If you need to check the output, you may need to write your own thread that will pipe the output)
Related
(OS is Windows 7 Professional. jq is version 1.5.)
I've been using jq to automate prettifying some JSON files (with Python). It seems to me after some time trying to determine why it wasn't working that jq fails silently when working with a file path string that's length 28, or simply stops working if the file path string is length 29 or more.
E.g. on cmd (and it's worth pointing out that I made a kind of shortcut so that jq calls jq-win64.exe, and tested the latter directly as well, so that's not the source of the issue):
C:\jq>jq . 123456789012345678901234567
displays prettified content of the file;
C:\jq>jq . 1234567890123456789012345678
displays nothing; and
C:\jq>jq . 12345678901234567890123456789
causes a "jq-win64.exe has stopped working" window.
(I also tested this on JSON files within folders; the common point was that the input string be of length 28 or more including slashes to fail.)
Is this a bug? If it's not, what can I do to work around it Okay, I admit that was a stupid question, I can work around it by copying content into a temp file in the base folder, prettify it, and then save it back to wherever I want it to be. More on-point question: is this the best workaround available for me to take?
There was a Windows-specific bug in jq 1.5 (see e.g. https://github.com/stedolan/jq/issues/1094). It was fixed shortly after the release of jq 1.5.
To obtain a post-1.5 .exe for Windows, see any of:
https://chocolatey.org/packages?q=jq
https://stedolan.github.io/jq/download
https://github.com/stedolan/jq/wiki/Installation#windows-using-appveyor
I am trying to use bleikamp's Processing package to run Processing sketches from the Atom editor. The package has installed correctly, but running a sketch produces the below error:
'processing-java' is not recognized as an internal or external command, operable program or batch file.
I have added the path to my Processing directory to the PATH environment variable. Can anyone suggest why this is not working?
The problem is almost certainly to do with your PATH. As you've checked the Processing path is correct, there may be something preventing it from being recognised (there are some known issues, such as the PATH variable being too long or having invalid characters).
Solution 1:
Try using FixPath to fix some of the more common problems.
Solution 2:
Try modifying the processing package itself to point directly to processing-java.exe (it points to the PATH variable by default).
In Atom's Settings > Packages, select the processing package and click on 'View Code'.
Make a backup of \lib\processing.coffee to be safe.
In \lib\processing.coffee, search for the following code (probably near the top):
module.exports = Processing =
config:
'processing-executable':
type:"string",
default:"processing-java"
Modify the value of default to point to the exact Processing directory and processing-java.exe, for example:
module.exports = Processing =
config:
'processing-executable':
type:"string",
default:"c:\\program files\\processing\\processing-java.exe"
As Chris rightly points out in the comments below, backslash \ is an escape character in JavaScript and CoffeeScript, so itself needs to be escaped in the file path (hence the double-backslashes \\).
You have to install processing-java command line tool.
In processing, go to Tools -> Install "processing-java"
I have QString variable named "src", which holds a filename. Operation QFile::copy(src, target) works Ok, until target is "C:" or "C:/" (I have the problem in Windows 10). In this case the operation returns true, even though I do not see any files actually copied to C:/ (in fact, normally I cannot copy anything to C:/ without administrator rights). Moreover, when I debug, I see that it says it has copied to C:// (two slashes). Is it a Qt bug or do I miss something?
UPD: Copying, e.g., to C:/Users which also requires administrator rights fails, as it should (returns false). Qt version is 5.7.
UPD:
QString src = "C:/Stuff/somefile.pdf";
QString target = "C:/somefile.pdf";
if (QFile::copy(src, target)) qDebug() << "Copy successful";
else qDebug() << "Copy failed";
This code yields "Copy succeful", whereas neither do I have write access to C:/ nor actually file somefile.pdf appears there.
When your application does not have permissions for writing to some directories, the files are stored into the Windows Virtual Store located at C:\Users\%USERNAME%\AppData\Local\VirtualStore. So in fact your file is successfully saved (albeit the path is redirected), that is why QFile::copy() returns true.
This redirection is called UAC Virtualization, and it works for C:, C:\Program Files, C:\Windows and HKLM\Software.
I guess the most genuine way to avoid such problems is to stick to saving configuration data in the designated locations such as application data (which in the context of the Qt framework will also meet the terms of cross-platform code).
I'm using Lua in interactive mode on a Mac (thanks to rudix.org).
When I want to load a file I do:
dofile("/my/long/path/to/my/directory/file.lua")
I want to do a different thing, that is:
put all my files in a desktop directory myDirectory;
then call the file from the terminal this way dofile("file.lua");
Is this possible? How?
If the path is fixed, you can just redefine dofile:
local _dofile=dofile
local path=("/my/long/path/to/my/directory/")
function dofile(x)
return _dofile(path..x)
end
You may put this (and other initializations) in a file and set the environment variable LUA_INIT to its location. After this, every invocation of lua will see the version of dofile redefined above and the users will be able to say simply dofile("foo.lua").
Alternatively, you can use require, which looks for modules in a list of paths in package.path or LUA_PATH.
I want to open a file in a windows program using R, but specifying the program rather than the default for the file extension, and for a file not necesarrily in my current R session home directory (this one getwd())
From looking at the documentation, using shell(), should be the way, but I seem to have an issue with the way R references the home directory or the way I'm writing the string.
e.g.
This works ok in the cmd "run" in windows: excel e:\test.xlsx
but using this
route <- "e:\\test.xlsx"
shell(paste("excel " , route, sep=""), flag="")
seems to get to excel (excel copyright notice is printed), but also prints the home directory and doesn't open the file in route. Thanks for any help.
Your command does the same for me. However, this works:
shell(paste("start", "excel", route))