0

I need to be able to add to use Terminal to:

  1. Add an item to a list in an Apple Script then
  2. Have the script quit (it runs as a background application) then
  3. Have the script relaunch

Would any of this be possible? I have no experience with shell commands, just Apple Script which I first started and made a script for yesterday, so any insight would be much appreciated :).

Bonus: Would it be possible to use the title of the current webpage being viewed as the item that gets added?

2
  • sorry, I don't understand what you are trying to do. Why do you want to use Terminal to add an item to AS list ? why do you think you must quit and relaunch your script ? What else your script is doing ? Commented Mar 11, 2016 at 16:07
  • 2
    You can't add to the list of a stay-open, running script process from some other script or terminal command. Your best bet might be to store your list in a text file or plist file. Then, both the script and whatever terminal app you're using can access it. Commented Mar 12, 2016 at 1:59

1 Answer 1

1

I agree with jweaks, you should approach this with a plist. You can do this with

defaults write com.domain.scriptName dataName 'dataValue'

That command can be done in the terminal or in an applescript. Change domain.scriptName to your own information. Change dataName to some name that represents your data and dataValue to the actual data you want to store. If you want to do this in an applescript...

do shell script "defaults write com.domain.scriptName dataName 'dataValue'"

If you do it with a plist, you shouldn't have to quit and restart your applescript, just have it read the plist file as it runs it's process.

set theData to do shell script "defaults read com.domain.scriptName dataName"

You can find more information here... https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/defaults.1.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.