I already posted about the same topic. But I realized that there is more simple solution to split an argument into several variables and pass them through Applescript to output and notification. This is the instruction.
Alfred Workflow - How to pass variables from Applescript to Output.
Above link is more complicated solution.
1. Split the Argument into Several Variables.
You can split the argument with "Split Arg to Vars" utility of Alfred.
Then, I set the delimiter as " " for convenience like below, not just a blank. It is a space.
2. Write an Applescript for your own purpose.
You can write an Applescript like below.
You can see the "splitText(q, " "). " " is the delilmiter you set.
And set the q, which means query for Alfred like above. The variables are conncted with &" "& just like the delimiter " ".
I don't know why exactly, you should set the c, the result of a*b, as text. If you don't, you can't set q starting with c. Of course, if you set the q starting with other than c, it would work.
If the query was "3 7", then the new query would be "21 3 7".
3. Split the Argument again.
The delimiter should be " " again, because the new query was set with " " in the middle.
As I mentioned above, the new query is "21 3 7."
If you split the query with delimiter " ", the result would be like below.
Split1 would be 21.
Split2 would be 3.
Split3 would be 7.
4. Pass the Variables into Output, as Notification.
If you set the notification like above, the result would be like below.
The query is 21 3 7. As you know 21 is the result of 3*7.
Split1 is 21, which is split from 21 3 7 as the first.
Split2 is 3, which is split from 21 3 7 as the second.
Split3 is 7, which is split from 21 3 6 as the third, the last.
And if you want, you can use split1, split2, split3 as variables with {var:split1}, {var:split2}, and {var:split3}.
I hope it helps.
'IT 관련 팁 > 알프레드 워크플로우' 카테고리의 다른 글
알프레드 워크플로우 - 알프레드와 키보드 마에스트로 연동, 연결하기 (1) | 2022.04.27 |
---|---|
알프레드 워크플로우 - Openmovie DB 검색 워크플로우 (1) | 2022.04.27 |
Alfred Workflow - How to pass variables from Applescript to Output. (1) | 2022.04.17 |
알프레드 워크플로우 - 세후 배당수익률 계산 워크플로우 (1) | 2022.04.02 |
알프레드 워크플로우 - 클립보드를 쿼리 query 로 사용하기 (0) | 2022.03.28 |