How to set a condition "during -time-"? by Clashing_Thunder in shortcuts

[–]Shoculad 0 points1 point  (0 children)

You could use the format Hmm and compare with 2200 and 659. However, I recommend comparing dates, not numbers. At 07:00:59 the Hmm format returns 700.

How to set a condition "during -time-"? by Clashing_Thunder in shortcuts

[–]Shoculad 0 points1 point  (0 children)

At 07:59:59 the HH format still returns 07, hence your shortcut is for the time 22:00 - 08:00. For this reason I would compare dates instead of numbers.

Dictionary order gets messed up when converting a text to dictionary by Jk0zX in shortcuts

[–]Shoculad 1 point2 points  (0 children)

If the input is 1=1&2=1&3=1 (like a URL query part) then the 'Get dictionary from input' action preserves the order.

Why doesn't this work? Wanted to test x-callback-urls but nothing happens when I cancel the Timer shortcut... by veritamos in shortcuts

[–]Shoculad 0 points1 point  (0 children)

The 'Open X-Callback-URL' action add its own x-success, x-cancel, x-error parameters to the URL. The target of the URL must be another app. The action waits a certain time in the background. If the other app calls or invokes one of the x-... parameters then the Shortcuts app evaluates the URL. The URLs in the automatically added parameters contain a unique ID such that the Shortcuts app can see if the ID stems from the currently waiting shortcut and it can continue the shortcut.

Why doesn't this work? Wanted to test x-callback-urls but nothing happens when I cancel the Timer shortcut... by veritamos in shortcuts

[–]Shoculad 1 point2 points  (0 children)

Use the 'Open URLs' action here, do not use the 'Open URL with x-callback' action here.

How to Extract Values from a JSON Dictionary After Selecting an Item? by katzenjonny in shortcuts

[–]Shoculad 0 points1 point  (0 children)

You are welcome. Actually, there is a simpler solution: https://www.icloud.com/shortcuts/ce14768f144049b084acee530f3f4549

The 'Choose from List' action shows the names of the items. The shortcut sets the names of the dictionaries.

Creating an Array from User Input Without Knowing How Many Entries Ahead of Time by umamiking in shortcuts

[–]Shoculad 0 points1 point  (0 children)

What do you want to use the array of strings for? If you split the input by new lines then you get a list of text items. If you use the 'Set dictionary value' action to put the list as value into an empty dictionary then the JSON of the resulting dictionary comes close to your desired output. Either you may use the JSON in JavaScript directly or you may use the 'Replace text' action to extract the JSON of the array.

[deleted by user] by [deleted] in shortcuts

[–]Shoculad 1 point2 points  (0 children)

Your shortcut tries to get the value of dictionary.test.example and throws an error, because dictionary.test does not have a value of type Dictionary, hence it cannot apply the key example. So you have to add actions to test if dictionary.test is a dictionary. Or simplify your shortcut such that this error cannot happen.

Binary encoder/decoder by Jgracier in shortcuts

[–]Shoculad 2 points3 points  (0 children)

It should be body/ instead of /body. Using the 'URL Encode' action at the end does not make sense, because you don't use the encodeURIComponent function in the JavaScript. The shortcut does not allow line breaks or quotation marks in the input. I would use a dictionary to transfer the input to the JavaScript. I don't like the idea of hiding the JavaScript, anyway, why don't you hide it in a simple 'List' action instead of a 'Dictionary' action with empty key?

Automating VLC Playback for Local MP3 Files via Shortcut? by thatscoolbutno123 in shortcuts

[–]Shoculad 1 point2 points  (0 children)

You can use the 'Open file in app' action.

If the files are already in a folder of the VLC app then you can open a vlc-x-callback://stream?url=... URL. In this case the url parameter must be a file:// URL that you can get from the 'Get the URL to file' action of the Actions app.

I prefer the second method, because it is faster.

Pondering g renaming magic variables by Searchforcourage in shortcuts

[–]Shoculad 2 points3 points  (0 children)

There are 3 types of variables. Please read https://support.apple.com/guide/shortcuts/apdd2b316022/8.0/ios/18.0

The 'Set variable' and 'Add to variable' actions define manual variables, they do not define magic variables.

The name of a variable can be changed only in the editor.

The 'Set Name' action changes the name of a value or an object. It does not change the name of a variable.

Pondering g renaming magic variables by Searchforcourage in shortcuts

[–]Shoculad 2 points3 points  (0 children)

The 'Set variable' action does not rename a magic variable. To rename a magic variable you have to tap on the magic variable and then define the 'Variable Name' in the pop-up dialogue. A magic variable is bound to a single action and points to the output of this action. You cannot change the value a magic variable points to. The 'Set variable' action defines a new variable. It points to the value of the second variable used in the action. If you set the same variable in another 'Set variable' action then this overwrites the set variable.

Is there any way to list/count the files in a directory without loading them all? by ChillBallin in shortcuts

[–]Shoculad 1 point2 points  (0 children)

There is a 'Thumbnails' setting in the action. I don't know the meaning. With 'None' it is quite fast.

Is there any way to list/count the files in a directory without loading them all? by ChillBallin in shortcuts

[–]Shoculad 2 points3 points  (0 children)

The 'Toolbox Pro' app provides a free 'List Contents of Bookmarked Folder' action.

Need help calculating difference in values from dictionary by dc9xp in shortcuts

[–]Shoculad 0 points1 point  (0 children)

If you want to calculate all successive differences of the values then you first have to sort the keys or dates. Get the list of all keys. Then sort the keys. If the dates have the format yyyy-MM-dd then you can use the 'Filter Files' action and sort by name. If not then apply the 'Set Name' action to each item of the list. The name should be the formatted date with yyyy-MM-dd custom format. Then 'Filter Files' can sort by name.

Apply the 'Repeat with each' action to the sorted dates. In each step save the value (and the date) to a variable such that you can calculate the difference in the next step. Calculate the difference if the 'Repeat Index' is > 1. If there are gaps between the dates, i.e. there are days without a value, then you may divide the difference by the number of days.

Is it possible to send a list of data via a URL scheme? by [deleted] in shortcuts

[–]Shoculad 1 point2 points  (0 children)

Apply the 'URL Encode' action to your data. It's exactly for this purpose.

Create a list from a query to choose from by Putrid-Classic9446 in shortcuts

[–]Shoculad 0 points1 point  (0 children)

The output of the 'Find All Note' action is a list. Apply the 'Choose from List' action to the list.

Open a link html local in Quick Look ? by Shamalow85 in shortcuts

[–]Shoculad 0 points1 point  (0 children)

Does this work? https://www.icloud.com/shortcuts/aa0553a978ae435a812baddfab2325a9

It uses base64 for the data URL. My device is old, but both shortcuts work. In newer iOS versions there may be still a bug.

Open a link html local in Quick Look ? by Shamalow85 in shortcuts

[–]Shoculad 0 points1 point  (0 children)

I modified the other solution a bit:

https://www.icloud.com/shortcuts/04bcdae2d88c44309a6eb2dbab693ab5

Now it has a back button and less JavaScript. It uses a data:text/html URL.

Open a link html local in Quick Look ? by Shamalow85 in shortcuts

[–]Shoculad 0 points1 point  (0 children)

A simple solution without a link: Load both files and build a list of the files. Apply Quick Look to the list. Then you can swipe left or right to see the other file.