Results 1 to 3 of 3
Thread: Runtime and Commands for Mac
- 01-22-2012, 04:16 PM #1
Runtime and Commands for Mac
I would like to know if anyone knows how to execute, command + option + Q using Runtime.getRuntime().exec("//code here"); this is for mac os x lion. I have a problem with the preview app. There is no com.apple.Preview.savedState folder... believe me, I've looked everywhere it could or should be and its not there and have changed the system preferences to stop it but Preview still shows previous images after reopening. I could just use the command + option + Q keys to close the last opened image in preview, but this is a program and it should be automatic. I've solved the problem by writing a different program using JInternalFrames, but I like using the simpler and smaller program. Right now I'm using Runtime.getRuntime().exec("killall Preview"); but that command only closes the Preview.app. When the program needs to open another image, it opens the new image plus the previous image and or images. killall Preview is a mac terminal command, but I don't know how to execute command + option + Q in the terminal. If I did I could get this to work.
any suggestions?
switch(i) {
case 0: execute this;
break;
}
- 01-22-2012, 05:14 PM #2
Re: Runtime and Commands for Mac
What's the preview (or maybe Preview) app?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 01-22-2012, 05:35 PM #3
Re: Runtime and Commands for Mac
Preview is a built in application that come pre installed with mac os x. It is an imaging application kind of like mspaint, except a little more advanced. To open with java you can use
Runtime.getRuntime().exec("open -a Preview.app"); -a is mac terminal command for the applications folder. As for windows you could use Runtime.getRuntime().exec("cmd /c start mspaint.exe " + imagepath); imagepath being a user defined string that includes the path, filename and filename extension to the file.
Similar Threads
-
AT commands in JAVA
By donpeter06 in forum Advanced JavaReplies: 2Last Post: 01-06-2012, 06:58 AM -
CMD is not reading commands
By colonial in forum Forum LobbyReplies: 1Last Post: 03-15-2010, 02:36 AM -
Problem with Runtime.getRuntime().exec with Linux Commands
By swapnilnawale in forum Threads and SynchronizationReplies: 1Last Post: 09-23-2009, 10:23 PM -
Using Runtime to execute external commands
By Java Tip in forum Java TipReplies: 0Last Post: 02-05-2008, 09:14 AM -
Windows Runtime Commands
By Java Tip in forum Java TipReplies: 0Last Post: 01-04-2008, 09:33 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks