This Siri Shortcut Can Modify your Projects | 𝓐𝔀𝓮𝓼𝓸𝓶𝓮_𝓔

It is…

okay I’ll gbot

2 Likes


Google really doesn’t like to help me with shortcuts smh

This topic seems to rank pretty high in shortcut-related queries, and it’s kinda ridiculous…
I’ve tried to look for stuff with shortcuts before, and "siri shortcut" modify json returns this topic as first result, and Siri shortcut modify json also puts this topic near the top

*GMA = get modding again

4 Likes

you will get modding again.

Not me

2 Likes

That means that I don’t think this has ever been done before with Shortcuts! So I guess it’s pretty cool, despite the lack of docs.

1 Like

Yeah it’s really amazing but quite annoying at the same time.

If you’re trying to learn something new, the last thing you need to find is something you already made, right? :joy:

4 Likes

Yeah for sure. :sweat_smile: I guess a lot has to be built from the ground up because of that.

2 Likes

And if you’re curious as to why I wanted the milliseconds, it was to more accurately benchmark action execution times, but I didn’t get that to work and I don’t really care that much.

What I do care about though is the JS execution time within shortcuts. I was able to successfully compress the script input so that the URL is much shorter. I use a base64 data url to generate a webpage to run the JS, so Shortcuts validates the base64 data URL. That means URLs with large projects take forever to validate (but idk why).

I decided to try gzip compression on the JS input, and despite making the minimum file size grow ~50KB, I’m seeing performance improvements of 100-300%

3 Likes

basic JS Execution method comparison:

  1. Method 1 – no compression
  • Shortcut input = JS to execute
  • Put that JS in a script tag
  • encode the webpage into base64
  • make a data URL with that page
  • get contents of that webpage
  • extract the text
  • that’s the JavaScript result
  1. Method 2 – compression
  • shortcut input = JS to execute
  • gzip the shortcut input
  • encode the gzipped input
  • use a template for the JS, where I set the data var to the encoded input
  • encode the templated page in base64
  • make a data url of that
  • get contents of webpage
    • decompress the string in JS
    • evaluate the JS
  • extract the text
  • that’s the result

A lot of stuff is added, such as string compression and a template, yet that makes the URL validation time change significantly.
It’s so much work for an optimization problem that shouldn’t exist imo :/

3 Likes

I thought you were modding! Instead of talking, Awesome A [Teacher]!!

2 Likes

I’m just doing both at the same time :)

2 Likes

okay AEawesome

1 Like

Another point is that I think the main audience that received Shortcuts are everyday people, or general power users, trying to have more efficient ways of doing everyday things, and not as much things like this that interface with app data. So that’s interesting too.

@Awesome_E Maybe you could connect it to the Clock app with Start Stopwatch and Stop Stopwatch actions? It seems a little makeshift but I guess it works better than nothing. I can’t think of anything better.

Yeah gzip is common practice for certain web files, I know that for sure. Glad you found a way to optimize.

1 Like

Yeah and I think that’s why it’s the preferred option for a lot of people.

there was a date function – it would have to have been contained within the shortcut to be accurate anyways, plus I don’t think there’s a way to do that.

I know that part, but it has to work offline. It’s weird because I added two libraries into the inline script, and that’s what actually handled the g-unzipping. It runs more JavaScript, yet it’s faster because of that URL validation


Today’s update – “hassle-free dependency installation”

^ seeing how fast that was, I am thinking about doing a bulk package installer as well.

@Good-Es

8 Likes

Are these released yet?

2 Likes

Not yet, but I’m working on it

3 Likes

Ok. Tag me when it’s out.

Hi @Awesome_E , I don’t know if this is the correct topic to ask in, but I have a question about the Project Builder on your GitHub page.

Does the File Size in the Project Traits section include images in the project, or is it just the size of the .hopscotch file?

4 Likes

^ this one

The images are stored separately from the file; if I wanted to include that size I would need to download the images as well


and if you have any more questions here is definitely the place to ask

5 Likes

Ok, thanks for the response! I guess I’ll just have to sum up the image file sizes.

5 Likes

So you’re saying that the final evolution of coding Hopscotch projects is with a new language called hopscript that allows you to write different pieces of your code separately in one GitHub repo, and an npm package compiles it into one .hopscotch project when you build it? (Note: that’s pretty much what TypeScript is)

I just made that up but it sounds so cool

7 Likes