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", "https://url.to.track", "Artist", "https://artwork.url")
Note: Please make sure the URL you're using is a direct link to a music file (for example: https://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", "https://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()