How to launch applications on Mac with Ruby?
-
Hi,
On PC, I am using UI.openURL(file_path) to open an application or run a batch file. This does not seem to work on Mac. Or does it? How do you launch an application on a Mac with Ruby?
Also, can you create and run a batch file on a Mac? Does Mac have something equivalent to batch files?
Thanks!
-
Hi Whaat,
There was a thread dedicated to this issue.In SU2KT I do it this way:
@unknownuser said:
Thread.new do
system(command options)
endI though it will allow KT to run without freezing the SU, but it works only for very limited time.
I hope we can find proper way to do it on both systems.
Tomasz
-
Ha. I find totally the opposite so in LightUp I have to do:
UI.openURL("file;//" + File.expand_path(filepath)) if filepath and not(PLATFORM.include? "mswin")On (my test) PC, it just crashes.
Un*x systems have very flexible 'batch files'. They can be arbitrary languages too but adding a line at the beginning of the batch file. Starting with:
#!/bin/bashmeans run this batch file using this flavor of shell (aka Cmd.exe in Win32)
-
@adamb said:
Ha. I find totally the opposite so in LightUp I have to do:
UI.openURL("file;//" + File.expand_path(filepath)) if filepath and not(PLATFORM.include? "mswin") >So this works to open an App or file on a Mac? (I can't test right now)
-
@unknownuser said:
Hi Whaat,
There was a thread dedicated to this issue.In SU2KT I do it this way:
@unknownuser said:
Thread.new do system(`command options`) endI though it will allow KT to run without freezing the SU, but it works only for very limited time.
I hope we can find proper way to do it on both systems.
Tomasz
Thank Tomasz, I am aware of the thread but I did not see a solution that worked with Mac. I am able to launch Indigo with parameters using a batch file on a PC (the command window closes after execution) but I am trying to figure out how to do the equivalent on a Mac
-
@whaat said:
[I am aware of the thread but I did not see a solution that worked with Mac.
I thought that
system(`command options`)works fine on Mac. At least I have had such an impression from posts from Mac users on KT forum.
Unfortunately I have no Mac available to test it on my own.
The method will probably block SU on MAC, so it is not a perfect solution anyway.Tomasz
-
@whaat said:
@adamb said:
Ha. I find totally the opposite so in LightUp I have to do:
UI.openURL("file;//" + File.expand_path(filepath)) if filepath and not(PLATFORM.include? "mswin") > >So this works to open an App or file on a Mac? (I can't test right now)
OK, it looks like PC just can't handle being given a scheme handler. If you just give the path on PC it works fine. On the Mac, it (correctly in my book) expects a scheme handler for the URL.
Adam
-
UI.openURL("file;//" + File.expand_path(filepath))works fine on a PC, if 'filepath' points to either an exe-file ora file-type... I don't see the issue ?
If you want to open a file with a particular app on a PC use a WinScript socket... -
Not on my WinXP laptop. Just crashes.
-
Works fine on my PC with Vista. Opens an app (.exe) or a file with it's assigned app...
Puzzling...
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement