More example scripts

Thanks for reporting the issue with the script.

The script was using Request.load() which has its behavior changes during the beta. I’ve changed it to Request.loadString() and the script should work now.

Hello,
I am trying to modify the script below:

How can I email attendees in the same script? I can reach attendees in Shortcuts, but not in Scriptable, it seems?

Thank you for that info and updating the script. It works great now.

Attendees are not yet exposed in Scriptable but that would be a great addition. I’ve added it to the backlog.

For now, maybe you could hand off control to Shortcuts and let it fetch the attendees.

1 Like

Thank you, I will check how to do the call Scriptable => Shortcuts ( => Scriptable)

I have looked further into adding attendees. The attendees of an event will be exposed in the next updated. Unfortunately, iOS doesn’t allow third party apps to add or modify the attendees of an event as described in Apple docs.

1 Like

Great, thank you for having researched!

hi there,

just starting with scriptable. very cool so far.

one suggestion for your commit scripts — both the first standalone one, and this newer one that works with shortcuts:

i’m also a very new user of working copy. combine all the newness here, and there were some initial runs of the standalone script that failed within working copy.

this was enough to delete all of the scripts i had made from my icloud directory, with no way to recover, as mentioned would be the case in the docs for FileManager.remove(filepath)

luckily it’s early enough that there wasn’t anything crucial in there yet, but as i’m sure is the case with most coders, the first few things i made took great time and effort to learn the code quickly, and i’d hoped would serve as reference for the more substantial things i plan to make.

if i were you, i’d rewrite the call to remove the files until all else is successful, so that this doesn’t happen to others. maybe a temp copy of everything first?

i think i’d also make comments about what needs to be done in working copy more specific, and to move the instructional stuff you do list in the posts above directly into comments in the scripts, so that they are there as you examine them in the app. i think the script failed once because i hadn’t yet created a remote for my backup directory. i don’t remember if you mentioned this in the latter script, but i don’t think you did in the standalone one. finally, i think in the first script, it would also help to explicitly name the working copy key more clearly, as you did in the post surrounding the latter script — “Working Copys URL key.” dumb of me, but i first tried the ssh pub key listed not far from the url key in the working copy config.

hope this all makes sense. let me know if not.

otherwise, thank you for the awesome app and your energy here on the forum!

Is it in some TestFlight version?
I don’t receive any prompt to approve Health access.

Unfortunately Apple did not allow Scriptable onto the App Store with the health integration so it’s no longer in the app.

3 Likes

Thank you for the prompt response.
Any plans to add it in the future?
Or probably get the data through another app with a callback? IFTTT has access to the Health but write-only (if I remember correctly).

I hope to bring it back in a future update. I just have to figure out an approach that will make Apples review team happy.

4 Likes

I am Trying to run the FileManager Script you posted above.
I copied the exact code, but I receive an error:
„Expected value of type Data but got value of type string“.

Can you tell me how to fix that?

That’s quite an old example and some of the functions changed a little in the mean time. In particular, check out the FileManager documentation in the app.

Try this.

let fm = FileManager.iCloud()
let dir = fm.documentsDirectory()
let path = fm.joinPath(dir, "myfile.txt")
fm.writeString(path, "Hello world")
let text = fm.readString(path)
await QuickLook.present(text)

Hope that helps.

I’ve few m3u8 streaming urls that i would like to play using your wwdc example which currently YT.Player API.
Can you please share an example?

1 Like

I found one and tested as working.

// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-brown; icon-glyph: magic-wand;
let html = `
<style>
body {
  margin: 0;
  padding 0;
  background: black;
}
.vid {
  width: 100%;
  height: 100%;
}
</style>
<div id="player"></div>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video"></video>
<script>
  var video = document.getElementById('video');
  if(Hls.isSupported()) {
    var hls = new Hls();
    hls.loadSource('https://video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8');
    hls.attachMedia(video);
    hls.on(Hls.Events.MANIFEST_PARSED,function() {
      video.play();
  });
 }
 else if (video.canPlayType('application/vnd.apple.mpegurl')) {
    video.src = 'https://video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8';
    video.addEventListener('loadedmetadata',function() {
      video.play();
    });
  }
</script>
`
WebView.loadHTML(html, null, new Size(0, 202))
1 Like

I am importing these examples including the comment part with scriptable variables. While the icon-color seem to be set right, the icon-glyph doesn’t seem to work and the icon always get set to the magic wand.

Are you creating a new script and then paste in the code? If yes, then Scriptable already crated these magic comments and ignores the pasted ones.

The other way would be to save the code with another app in the iCloud Drive/Scriptable folder.

I understand that Scriptable add the special header automatically. I am using the second method, using Textstatc to edit the script and saving them in the iCloud Drive/Scriptable folder.

Assuming that’s a typo and you are editing via the Textastic app have you tried editing any of the ones created directly in Scriptable to see if there is a difference in the initial meta data?