|May 6, 2012, 07:42 AM||#1|
Support with Applescript
Hi. I'm currently working on a Project for a Game. And I'm stumped on what to do next.
I mean, I know what I want to do, but I don't know how to do it.
I want to run a Shell Script that downloads a bunch of Shell Scripts into ~/Library/Application Support/minecraftmodinstaller/
So far, I've written the scripts but don't know how to implement them.
I would also like to know how I could link the downloaded scripts to buttons in Xcode. I have made the links but don't know the code to make the button open them.
My scripts can be found here. They're reasonably long...
And the Downloader script can be found here.
P.S - This App is Written in Cocoa-Applescript
Thanks in Advance
|May 6, 2012, 11:09 AM||#2|
In Xcode 3.x.x an on clicked theObject handler would to the trick. Things changed with Xcode 4. Check out http://macscripter.net/viewtopic.php?id=30274
on clicked theObject if title of theObject = "" then -- run/open your script end if end clicked
Last edited by kryten2; May 6, 2012 at 11:15 AM.
|May 7, 2012, 03:57 AM||#3|
Ok, new problem. When I try and run my Script. I get this error.
"Command /usr/bin/osacompile failed with exit code 1"
Here is my Code.
on clicked theObject if title of theObject = "Update Installers!" then run shell script "rm -rf ~/MCInstaller/scripts/; mkdir ~/MCInstaller/; mkdir ~/MCInstaller/scripts/; cd ~/MCInstaller/scripts/; curl -O http://mossycc.com/Latest/installers.zip; unzip installers.zip -d ~/MCInstaller/scripts/; rm -rf ~/MCInstaller/scripts/__MACOSX/; rm -f ~/MCInstaller/scripts/installers.zip" end if end clicked
Eg. I have a Workflow/Script in my Resources folder of the App. But when I drag the file into the Code. It links to it as though I was pulling it in from the Finder.
Last edited by Haribo98; May 7, 2012 at 04:01 AM. Reason: Forgot the last bit.
|May 7, 2012, 09:54 AM||#4|
I've only made some very simple little apps in Xcode 3 myself and barely scratched the surface of Applescript. I think your run shell script causes the error, you can run .scpt files but not run shell script. Try this line in Script Editor and check if things are removed, folders created, curl line works etc. If it works you can adjust your code.
do shell script "rm -rf ~/MCInstaller/scripts/; mkdir -p ~/MCInstaller/scripts; cd ~/MCInstaller/scripts/; curl -O http://mossycc.com/Latest/installers.zip; unzip installers.zip -d ~/MCInstaller/scripts/; rm -rf ~/MCInstaller/scripts/__MACOSX/; rm -f ~/MCInstaller/scripts/installers.zip"
-- change line below to where you saved your .workflow set workflowpath to "Macintosh HD:Users:martin:Desktop:Example.workflow" set qtdworkflowpath to quoted form of (Posix path of workflowpath) set command to "/usr/bin/automator -v " & qtdworkflowpath set output to do shell script command
Last edited by kryten2; May 7, 2012 at 10:24 AM.
|May 7, 2012, 11:30 AM||#5|
I am not able to access your project to look, but on clicked theObject is an AppleScript Studio handler, which will result in a compile error when building the project if you are using current versions of Xcode with AppleScriptObjC (AppleScript Studio is deprecated as of Snow Leopard).
What OS/Xcode versions are you using? Can you post a smaller example or use a different host that is reliable?
MacBook Pro / OS X Yosemite (10.10) / Xcode 6.1 / RubyMotion FTW
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|AppleScript Support Comes Back to Numbers, Could Signal a Return of Power User Features||MacRumors||Mac Blog Discussion||42||Jan 30, 2014 09:22 PM|
|AppleScript: How do I save multiple Excel sheets to one pdf using Applescript||sbtaylor1||Mac Programming||0||Oct 29, 2013 12:38 AM|
|AppleScript: How do I save multiple Excel sheets to one pdf using Applescript||sbtaylor1||Mac Applications and Mac App Store||0||Oct 29, 2013 12:32 AM|
|U.S. Carriers Unlikely to Support iPhone 5's Wideband Audio, European Support More Likely||MacRumors||MacRumors.com News Discussion||127||Jan 9, 2013 10:22 PM|
|support full-screen for iPhone5 with support iOS from 3.2||sebasx||iPhone/iPad Programming||5||Nov 29, 2012 09:23 PM|
All times are GMT -5. The time now is 03:43 AM.