Hi everyone I'm Alex, developer of Toolbox Pro

Thanks @RosemaryOrchard for the subforum!

If anyone has any questions about how any of the Toolbox Pro tools work or any suggestions for new tools please let me know!

I recently added “Create Images From Text” tool which lets you create styled text with a transparent background you can overlay on existing images and a suite of new Apple Music tools, which subscribers to Club MacStories would’ve seen put to impressive use in Federico Viticci’s MusicBot Pro shortcut.

I’m working on a great new update with more music tools, powerful new control over notifications, the ability to add contacts, read QR codes from static images and get workout data from Health (that last one is tentative since I’m not sure if Apple will let it through review yet!).

I’ll post here when it’s available :slight_smile:

8 Likes

Hey Alex!

It’s a great app! One main use case of mine was to build nicer menus (the contact card hack). But I found it quite tedious compared to setting up a classical Shortcuts menu that also allows to easily rearrange items. Is it possible to build a similar structure as an action? Or this reserved to Apple and not third party devs?

As I wanted to use custom icons I had to fist grab the app icons from the store via another Shortcut, which I found on reddit or routinehub, and had to run another separate Shortcut to convert them to base64. I then stored them as text in the actual Shortcut containing the menu, decode them one by one and feed them as image via magic variables into Toolbox’ “Create menu item” actions. Is there a simpler way to implement a file picker into that action that stores the image as bases64 directly in the action’s variable?

Another tedious job is to later build the set of if-statements (due to the lack of a swich-equivalent in Shortcuts) to perform the corresponding action to the selected list item.
I would really appreciate some way to streamline this. Maybe with an entirely separate menu builder/manager outside of Shortcuts. So that the entire menu could be copied as text and imported as a variable.

Generally the performance of those menus seems slow. I’ve set up a list of 8 camera apps with their regarding icons. And it takes around 4 seconds after the start until the menu is shown.
I thought the issue was decoding the base64 images and building the contact cards, so I tried storing the entire menu variable that contained all entries in the app Data Jar to access the same menu from various Shortcuts. This however didn’t seem to improve the performance.

Do you happen to know what is the bottleneck?

Thanks a lot :slight_smile:

2 Likes

Hey Leo,

Thanks for your message.

Unfortunately, developers can’t build custom actions with custom UI like Shortcuts’ Menu action, we’re limited to parametrised actions (at the moment).

There isn’t an option to embed base64 in the action itself at the moment, but I’ll look at adding it. That’s actually the first request I’ve had for it and it makes sense as a feature.

If I was making a menu that way I’d probably create a dictionary with the key being the title of the menu item and then a nested dictionary containing the base64. I’d then decode the icon in a repeat action so you only have one ‘Create Menu Item’ action - a similar format to this example shortcut.

I agree building the if statements are tedious and a switch case ability would be so much better. I’m not quite sure if I’d have the tools to fix the if statement problem - anything I could build would still require a load of if statements as far as I can imagine. If I built a menu builder outside of shortcuts that generated a shortcut with the menus in, it wouldn’t be embedded into the source shortcut but would be a separate one and then it gets a bit messy.

The menus are definitely slower than showing a normal menu but 4 seconds seems slower than I’d expect. What size are the images? For optimum speed they should be around 123px (that’s what the Create Menu Item resizes them to automatically). I’ve knocked a couple of steps where I can out in an upcoming version so it should be slightly quicker.

The tool is really designed to make dynamic menu creation much easier (i.e images from URLs returned from an API as menu icons). If your menu isn’t dynamic and you’re concerned about speed, one tip I’d suggest is that you use the tool to prebuild your menu as a VCF card (since that’s what it’s doing in the backend anyway). You can grab the raw VCF card from the menu tool like this, that way you don’t have to create it dynamically every time the shortcut is run.

Hope that helps!

3 Likes

Performance on menus seem’s okay for me, but larger images can slow it down, so definitely worth using icon size rather than publishing sizes.

In terms of a switch statement, I would say that is functionally equivalent to calling a function at a set point in the flow, but with a variable name; dynamic evaluation if you will. Therefore if you create a shortcut for each unique switch case, and use Run Shortcut, referencing one of the menu item data field (or embedded as an element for the item in a base set of JSON), that should give equivalence.

The main downsides are that you can’t then distribute as a single shortcut, and you may need to deal with passing in/out items of data.

1 Like

Would it be possible to provide a checkbox upon the import dialog whether the image should be scaled down to 123px? That would be very handy.

For sure, the external menu builder is just a rough idea.
The idea was that Toolbox Pro provides an easy interface (+) to add an item, reordering, tap the empty round image to add a photo or pick an icon/color etc. and then store the menu with a distinct name inside Toolbox Pro. A new Shortcut action “Get Menu {name}” could then call the menu from Toolbox Pro dynamically.

My attempt so far was basically how you described it:
I was looping over the menu items, encoding all vcards as base64, joining the base64 strings with a separation string into a single text element and writing it to Data Jar for temporary storage.
To reuse the menu in another shortcut I would read it from Data Jahr and split the text at the seperator string into separate elements and loop over each item with a base64 decode and writing it into a menu variable.

Still quite complicated, actually.

The dictionary idea is great! However, I’m not sure whether there is a noticeable performance increase if the base64-image decoding and vcard creation loop can be skipped (see approach above). This would require some more testing.

Regarding the switch-case in conjunction with what @sylumer suggested:
That would actually be very useful Toolbox Pro action, even though it can be a bit tedious to explain how to set it up, as it exceeds the scope of one example shortcut.

What I described was a set of existing Toolbox Pro and Shortcuts actions that could be used right now.

What would you see being made into a Toolbox Pro action from that?

As far as I am aware you can’t use the “Run Shortcut” action in conjunction with a variable (shortcut name or UUID etc.)
So looping over a dictionary/JSON wouldn’t be of help.

Toolbox Pro could, however, provide a “Create Advanced Menu” (from a dictionary/JSON, which contains title/subtitle/base64-image) action, which’s output is the series of vcard files that can get directly passed into the system’s “Choose from List” action to create the menu.
The result (selected item) of that could then be passed into the “Run Advanced Menu Shortcut” action, which requires two inputs:

  1. The chosen key and a dictionary/JSON to match against that consists of the key and …
  2. … some identifier for the Shortcut to run.

I assume that there is a way for external apps to run a specific shortcut, as this is heavily used by LaunchCuts and other apps.
The only difficulty I see is getting the identifiers of the shortcuts that work as functions for the user to write to the dictionary/JSON in a convenient manner.

Additionally maybe Toolbox Pro could also be of help passing data between those “function calls”, which currently isn’t possible, as you’ve also mentioned. Maybe by providing temporary storage inside the Toolbox Pro app. That could make abusing the clipboard as the temporary storage obsolete.

I believe it can. Here’s an example of picking out a shortcut name from a dictionary.

The existing fields could b used for this with the above simply by name.

I actually said you would have to do it, not that it is impossible. I’ve been passing data to Shortcut Input via simple variables, lists and dictionaries since Workflow. The inconvenience is that you have to pass in and manipulate the data when you are handing off to another shortcut rather than having it immediately available and referencable within a single shortcut.

I hope that clarifies things.

2 Likes

Oh, I did not see that at the very bottom of the Shortcuts list variables are listed. I always dismissed the selection dialog, thinking you have to make a selection.

Good to know!

1 Like

I’m struggling a little bit with the tally example. I’m trying to add date information to each time I add to a tally but it doesn’t seem to show up when I view the JSON file. Any tips?

Can you post a link to that? Maybe I’m just tired, but I don’t see anything that’s obviously a tally examples listed (under show all) in the app.

https://www.icloud.com/shortcuts/af33e816595c4331b94db9f5f4874b63

That really isn’t listed anywhere amongst the examples I can see. Very strange!

When I run it on my iPhone 8, it runs fine, and I can see the counter (called “foo” here) incrementing successfully.

Q) What did you provide as the name of your counter?

Unfortunately, I did try running it on my iPad first and there example could do with an If action adding in as it terminates the shortcut at this point…

image

I provided the name PainMeds because I want to track how many and how often I’m taking medication for my back pain. It adds the number fine but when I go to look at the JSON file in JAYSON it only shows the running tally but with no time and date data like you can see in the first screen shot.

What I want to achieve ideally is a running tally plus a list of times and dates so I not only know how many I’ve taken but when exactly during the day.

Ah, okay, got it. So it isn’t there’s nothing at all, you just need the date time info too.

This modified version has two amendments.

One is the addition of a key called lastUpdated to the dictionary. This is set to be the current date time and occurs towards the end of the shortcut.

The next actually comes in much earlier and is applied because the dictionary and shortcut as currently defined will store multiple tallies in the same dictionary. Therefore if we do nothing, when the dynamic list of tally fields is generated for the menu/list, it will include lastUpdated. So I added in a filter for the list generated from the get keys action and changed the loop to use the filtered instead of the sorted list. Like this:

That then gives me the data in the dictionary like this.

lastUpdated would be updated any time any tally is updated in the tallyData dictionary, so if you want one for tracking something specific, make sure to give the dictionary an appropriate name so that you are not tempted to add another tally, and consider paring down the shortcut to remove the chance of accidental addition/deletion.

Hope that helps.

2 Likes

Lovely stuff, thanks for sharing @sylumer

With the iPad haptic feedback action, you an toggle the option to ‘vibrate if unsupported’ and it won’t show the error dialog. I should’ve set that as the default, apologies!

I’ve been fairly iPhone-centric thus far since I only had an iPhone but since I just got my paws on a new iPad I’m using tools with it a lot more!

1 Like

Mystery kind of solved. Somehow my devices were running what looks like an old beta that seemingly was in limbo on expiry! One download and purchase later and I can see the tally example :roll_eyes:

I was wondering about that! I thought I’d expired all the old betas, which would mean they wouldn’t open and would just show a ‘beta expired’ message… but apparently I should double check! :joy:

Thanks for clarifying :+1:t2:

@mralexhay great update posted today! I love the Soulver integration. Brilliant!! Thanks for your continued contributions to our automation community… — jay

1 Like

Thanks, glad you like it! Will write a post up on here about it soon

2 Likes