Hey and Thanks in advance for helping
Im trying to make a cooca app that is using applescript in it. Now I have all the scripts and interface done and set to on click object run script bababa… but it won’t run. Heres the script im trying to run
display dialog "Search for Music File:" default answer ""
open location "http://www.google.ie/search?hl=en&q=-inurl%3A%28htm%7Chtml%7Cphp%29+intitle%3A%22index+of%22+%2B%22last+modified%22+%2B%22parent+directory%22+%2Bdescription+%2Bsize+%2B%28.ogg%7C.mp3%7C.aac%7C.flac%7C.aif%7C.wma%7C.m4a%29+%2B%5Bsnd%5D++]" & encodeURL(text returned of result)
on encodeURL(someURL)
return do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(unicode(sys.argv[1], \"utf8\"))' " & quoted form of someURL
end encodeURL
on launched theObject
set theDialog to display dialog "Search for Music File:" default answer ""
set theAnswer to text returned of theDialog
open location "http://www.google.ie/search?hl=en&q=-inurl%3A%28htm%7Chtml%7Cphp%29+intitle%3A%22index+of%22+%2B%22last+modified%22+%2B%22parent+directory%22+%2Bdescription+%2Bsize+%2B%28.ogg%7C.mp3%7C.aac%7C.flac%7C.aif%7C.wma%7C.m4a%29+%2B%5Bsnd%5D++]" & encodeURL(theAnswer)
end launched
on encodeURL(someURL)
return do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(unicode(sys.argv[1], \"utf8\"))' " & someURL
end encodeURL
Error -1708 is some object didn’t understand what it was messaged.
I got this a couple of days ago and it turned out to be that ASS wanted a “on will finish launching theObject” handler in my script.
See if there are handlers checked in IB that you don’t have code for in the script. Once I went through and made any changes in IB, it put the will finish launching handler back in the script and the -1708 error went away.
Sometimes it won’t let you uncheck events so you wind up with unused empty handlers.
I sure wish there was a book for this - it is pretty hopeless trying to find answers in Apple’s large but useless documentation.
Using Script Debugger to send commands to the running ASS app is the most useful thing I have found. However, if you have a Debug build and a release build of your ASS app, sometimes the script editor will open the wrong one and queries to it will of course return the wrong data. So delete one of the executables if you have two.
set theDialog to display dialog "Search for Music File:" default answer ""
set theAnswer to text returned of theDialog
open location "http://www.google.ie/search?hl=en&q=-inurl%3A%28htm%7Chtml%7Cphp%29+intitle%3A%22index+of%22+%2B%22last+modified%22+%2B%22parent+directory%22+%2Bdescription+%2Bsize+%2B%28.ogg%7C.mp3%7C.aac%7C.flac%7C.aif%7C.wma%7C.m4a%29+%2B%5Bsnd%5D++]" & encodeURL(theAnswer)
on encodeURL(someURL)
return do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(unicode(sys.argv[1], \"utf8\"))' " & someURL
end encodeURL