Clean Text for iOS offers URL Schemes support which you can use to launch the app via a link and perform certain actions.


If you use another app that supports opening URLs like Workflow, here you can learn about Clean Text’s URL Scheme capabilities to interact with the app.


The Clean Text URL Scheme allows you to open the app or run a certain action on the text got from Clipboard or the text passed via URL parameter.



Launch the app


cleantext://

cleantext:// (example)




Launch the app and run an action


cleantext://run?action=[action-name]
cleantext://run?action=rot13 (example)


This code populate the main text field of Clean Text with the text from the Clipboard then run the action specified in the action parameter.




Optional parameters


text

Tells Clean Text to populate the main text field of Clean Text with the text in the URL instead of using the text in the Clipboard.


cleantext://run?action=[action-name]&text=[encoded-string]
cleantext://run?action=uppercase&text=Some%20text (example)


Note, don't forget to URL encode the text you put into text parameter (to do this, you can use the URL Encode action of Clean Text). Note that for avoiding to get unexpected results, the URL Encoding command has to be used only on the text to be placed in the "text" parameter, not for the entire URL.


next

Tells Clean Text to open another app supporting URL Scheme when the action has been successfully performed. Also, if this parameter is present, the Clipboard will be updated with processed text. This way you can easily paste the text in the app that was opened for you.


cleantext://run?action=[action-name]&next=[app-to-open-scheme]
cleantext://run?action=rot13&next=mailto (example)


Some common URL Scheme to use in the next parameter are: mailto, tel, sms, twitter, workflow. Please note: the "next" command parameter is executed only if there is not a "x-success" parameter (please read the X-callback-URL section below).




X-callback-URL


Clean Text supports x-callback-url, allowing the calling app to receive a response when a particular action has completed. Here’s an example:


cleantext://x-callback-url/run?action=uppercase&text=Some%20text&x-success=[url-to-open]x-error=[url-to-open]




X-callback-URL optional parameters


x-success

The URL to call back after Clean Text has processed the call (if unspecified, Clean Text will remain in foreground). Clean Text puts 


?result=[encoded-processed-string]


at the end of your custom x-success URL. This is used by the apps that can look at the x-success URL to get the processed text (e.g. Workflow).


x-error

The URL to call back if it fails for some reason. If unspecified, the x-success URL is called.




Example of automation with Clean Text and Workflow


In this example we will see how to build in Workflow, a workflow that uses Clean Text to make text uppercase and then create a note with the processed text.



  • Open Workflow and create a new workflow.
  • Drag the "URL" action to the work plan.
  • As a URL, enter this text (note that the text parameter "My new note" has been encoded with %20 encoding (available in Clean Text actions):


cleantext://x-callback-url/run?action=uppercase&text=My%20new%20note.


  • Drag the "Open-Callback URL" action to the work plan (this Workflow action automatically manages the x-success and x-error parameters so you will not need to add them to the URL).
  • Drag the "Get Text from Input" action to the work plan.
  • Drag the "Create Note" action to the work plan.


Now press the Play button and you will see Workflow automatically perform this workflow involving Clean Text. You have created this workflow, without ever opening Clean Text manually.




URL Scheme action-names accepted by Clean Text


Smart tools:

        clean

        cleanandcompact

        cleanclipboard


 Fix:

        fixspaces

        fixlinebreaks

        joinparagraphs

        stripquoteprefix


 Remove:

        removespaces

        removereturns

        removespacesandreturns

        removeemptylines

        removelinenumbers

        removeduplicatelines


 Trim:

        trimspaces

        trimemptylines

        trimspacesandemptylines


 Replace:

        tabswithspaces

        spaceswithtabs

        tabswithfourspaces

        fourspaceswithtab

        ellipsistothreeperiods

        threeperiodstoellipsis

        spaceswithreturns

        returnswithspaces

        onereturnwithtwo

        tworeturnswithone


 Quotation marks:

        curvedquotes

        straightquotes

        anglequotes

        cjkquotes

        singletodoublequotes

        doubletosinglequotes


 Change case:

        sentencecase

        titlecase

        uppercase

        lowercase

        randomcase


 Convert:

        htmltoplaintext

        urlencoding

        symbolstodescription

        emojitodescription

        rot13


 Process:

        increaseindent

        decreaseindent

        addlinenumbers

        addquoteprefix


 Extract:

        extractlinks

        extractemailaddresses

        extractphonenumbers

        extractuniquewords


 Sort:

        sortlines

        sortlinesinreverse

        orderwordsalphabetically

        reverse


 Pseudo text:

        upsidedown

        mirrored


 Find and Replace:

        find (opens the Find panel)

        replace(opens the Replace panel)

        regularexpressions(opens the Regex panel)







Related Links