aMule Forum
English => Multiplatform => Mac OSX => Topic started by: wuischke on January 01, 2009, 10:39:52 PM
-
Hello to our Mac specialists,
there are sometimes user reports about aMule not opening, apparently without an error message. The standard response is to start aMule in a terminal to see the error.
Wouldn't it be nice if we had a script which caught the output of aMule and displayed the output in a message in case of an error?
An out of the head bash example:
amule | tee amule.out
if [ "0" != "$?" ]; then dialog "$(cat amule.out) 0 0; fi
Is there any Mac user who would know how to go about this?
-
perhaps this applescript can help.
you select your amule.app (the script adds the path to the binary in the package) and then amule gets started from shell. after closing amule the output is saved to the file output.txt on your desktop.
i can't try it with a non-starting amule because it works here but in theory it should't make a difference if you close it or if it close itself because of an error.
on run
set amulePath to choose file of type "APPL" with prompt "Please select your Amule:"
set amulePath to POSIX path of amulePath
set amulePath to amulePath & "Contents/MacOS/amule" as text
-- show path
-- display dialog amulePath
do shell script amulePath
set the_output to the result
-- save output to file
set theFileName to (path to desktop folder as text) & "output.txt"
try
close access file theFileName
end try
set theFileName to open for access file theFileName with write permission
write the_output to theFileName
close access theFileName
-- display output (optional)
-- display dialog the_output default button {"OK"}
end run
-
Thanks a lot for your help, this will make resolving errors much easier for everyone involved!
Oh: Excuse my ignorant question, but executing an applescript is as easy as double clicking on the file, isn't it?
-
a good question. in fact the former upload opens in script editor where you have to click the "run" button. so here it is saved as runtime.
you can open it in scripteditor anyways just to be sure it doesn't burn your house. ;)