Along with being a big fan of Apple, I am a fan of MacStories.Net and Federico Viticci who founded that Apple-centric website from Italy and his writing. What caught my eye recently was a great review of the PCalc App’s update (version 3.8) to take advantage of the APIs that Apple recently in IOS 12 regarding Siri Shortcuts. Federico really praised how PCalc integrated setting up Siri Shortcuts in the app and he said it was a great model for other apps. Federico also gave an example about how cool the automation will be in iOS 12 with the Siri Shortcuts and the Shortcut app that Apple released. You can read Federico’s article here.
One of the things Federico highlighted was the the PCalc app now allows you to create Siri Shortcuts using the clipboard in iOS as an input. And he gave an example where PCalc can convert currency to another currency using input from copying a number to the clipboard. He then explained that after you create some Siri Shortcuts for PCalc, you can then see those Shortcuts in the Shortcut App that Apple created and then you could chain together the shortcuts and name the combination for a shortcuts for that combination. Basically, the idea is that you can pick a number for the currency you want to convert, and then it will convert it to various currency using the Shortcut App and the Shortcuts that are in PCalc that you created.
So I tried doing that but I ran into a problem. When I used the Shortcut App and selected PCalc Shortcuts, the problem was that once it converted one number, it than put the answer in the clipboard, and so the next conversion, rather than using the original number in the clipboard used the new number in the the clipboard.
For example, I experimented with converting Euro’s to British Pounds and also to the U.S. Dollar. The input was 100 Euros. It converted to Pounds correctly, 88.88 Pounds, but then used that number to convert to dollars, instead of 100 Euros.
So on Twitter I reached out for assistance from Federico and the developer of PCalc, James Thomson, was kind enough to respond also. Here is what he said.
So James Thomson confirmed that the way PCalc works is that the output is added to the clipboard.
Referring to features in the Shortcuts App, Mr. Thomson suggested the following that could be a possible fix.
Well with that solution, I found a workaround. And while I used the clipboard, I also added a feature where the Shortcut prompts me to fill in a number for the Euro, and then it first tells me that the first conversion number was an English Pound, and then when I was ready give me the Pound conversion number, and then tells me the next conversion is the U.S. Dollar, and the answer for the conversion to the Dollar, and then tell me the next conversion was the Chinese Yuan, and then the conversion answer.
In the Shortcut App here is how I did it. First, I used the scripting function “Ask for Input” where I set the question for the prompt to be “Enter Euro.” That prompts an input and I set the value to “number” as I want a number, the value of the Euro I want to convert.
Then I add the script “Get Variable” and I set the “Magic Variable” to the “Ask the for Input.” This grabs the input and then passes on that variable to the next step, the script “Copy to Clipboard.” The number I input becomes a variable which was then pasted into the Clipboard. Because when I first did this the output was just a number without a label, I inserted a script to first label what the next number that was shown would be. So I installed a script “Show Result” and typed in Pounds. This shows the word “Pound” before the conversion number is revealed. The next step was that I added the Siri Shortcut I created in PCalc, which take the variable I added to the clipboard and converting the Euro number to the Pound number.
I repeated these 5 steps for the conversion to Dollars and Yuan. So all together 15 steps. The trick is because each time, the “Get Variable” is set to “Ask for Input” and then pastes into the clipboard, the clipboard for the subsequent conversions is not the output from PCalc’s prior conversion, but instead the original input that I typed in. That way, for example, if I convert 100 Euros, each conversion uses my original 100 Euro input.
Here is a video showing how it works.
I agree with Federico that PCalc’s implementation of Siri Shortcuts is really great. You should check out Macstories.net and PCalc.