Logic Script examples
(Logic tab --> Script action)
-- App --
PlayMusic / PlayAudio
Description: Play music
Methods:
- playmusic(string url)
- playmusic(string title, string url)
- playmusic(string title, string url, string artists, string artworkUrl)
- playmusic(string title, string url, string artists, string artworkUrl, string purchaseUrl)
Example: app.playmusic("Sample Track", "http://url.to.track", "Artist", "http://artwork.url")
Note: Please make sure the URL you're using is a direct link to a music file (for example: http://www.example.com/music.mp3). Using a link that leads to a third party music player will not work.
Example: app.playmusic(screen.currentitem.title, screen.currentitem.enclosure.url, "", screen.currentitem.media_content.url)
This will use the fields from your Excel or Web Service.
title |
title |
enclosure_url |
url to the stream |
media_content_url |
cover art image |
StopMusic
Description: Stop the currently playing track
Method: stopmusic()
Example: app.stopmusic()
Save Event to your Calendar App.
Description: Save event to calendar upon click of a button.
Method: start.start => app.addevent(name, startDate, endDate, location, url)
Example:
start.start => app.addevent("Dance Event 2016", "08/25/2016 18:00", "08/25/2016 23:30", "Amsterdam, the Netherlands", "http://www.danceevent.com")
fields from Web Service or Excel
start.start => app.addevent(screen.currentitem.eventTitle, screen.currentitem.eventStartTime, screen.currentitem.eventEndTime, screen.currentitem.location, screen.currentitem.website)
-- WebService --
Execute:
Description: Call this method to execute the webservice. When a previous result is available that will be the result of this method.
Method: execute()
Example: webservice.execute()
Comments
6 comments
Can you give an example of the intended use of the properties? Are they meant to be used in a Script-action in the OnClick-repsonse of a button, for example?
Is there a full list of these methods? Where do we find the options and variables???
I would like to have this documentation either.
There are so many different variables used in so many different cases.
I would like to call a block from a script. Not with the default goto function. But from a script so that I can pass a variable. So one variable goto block A and another variable goto block B
Hi Johnny,
I got app.playmusic() working great with a simple button. Now besides playmusic() and stopmusic() are there other methods not listed here that I can use to control the player?
Your native player works great but it's more tailored for music and not podcasts. I want to add find a hack (perhaps using a script method) where I can add "skip back 15 seconds" and "skip forward 15 seconds" function into the playlist so that the << and >> buttons on native player instead of skipping to another track, will skip seconds.. then I can replace those << and >> images with a loop back/forward images and have a more user-friendly native podcast player in appmachine. Do you think this is possible by tweaking something in Logic scripts?
Also I got playmusic(string title, string url, string artists, string artworkUrl, string purchaseUrl) fully working but wanted to know is there any way I can change the "Buy" text from purchaseUrl. Thanks! Rob
Please sign in to leave a comment.