@hackworks:
Yes I need still help in matching a pattern and transforming it.
I suppose that I need a Python-, Ruby- or perhaps AppleScript-Code for transforming phone numbers like 0798008080
from the Clipboard (simple copy the number by ⌘-C on a Mac) to 0041 79 800 80 80
and 079 800 80 80
to 0041 79 800 80 80
:
- ⌘-C (copy) a phone number (
0798008080
) to the clipboard
- Go to another application, we say Evernote/Word etc.
- Tipping a defined abbreviation from Textexpander like
;phone
which paste the transformed phone number 0041 79 800 80 80
into Evernote/Word etc.
The Python-, Ruby- or AppleScript-Code transforming the phone number is within the snippet ;phone
from Textexpander:
- If I type the shortcut
;phone
(or whatsoever: the shortcuts can be defined by the user itself), Textexpander should get the content from the clipboard (for that, the code %clipboard
can be used within Textexpander),
- then initiate a
- Python-, Ruby- or whatsoever-code transforming the clipboard content (here: phone number),
- transfer the transformed clipboard content to Textexpander,
- which will (e) replace the shortcut
;phone
(Textexpander) with the transformed phone number and will insert the transformed phone number in Evernote/Word/Excel whatsoever
1, 2, 4 and 5 will be done by Textexpander. The clipboard content "transforming" Code will be also placed directly in the Textexpander snippet, in other words, Textexpander will initiate the Python-/Ruby-code.
In the example
#!/usr/bin/python
import sys
selection = """%clipboard"""
sys.stdout.write(selection.upper(),
Textexpander will do like a similar process: This code is written within a Textexpander snippet. A shortcut like ;uc
(for uppercase) tipped in Word will start the Textexpander snippet. Textexpander will get the clipboard content (%clipboard), push a Python code (sys.stdout.write(selection.upper(),
) to uppercase the clipboard content, and insert the transformed clipboard content in to Word. #!/usr/bin/python
, import sys
and selection
also have something to do with Python (I suggest so), but I'am far away from really understand Python.
So, what I need is a Python/Ruby-code for transforming phone numbers formatted like 0798008080
and 079 800 80 80
to 0041 79 800 80 80
and to put in the code within Textexpander-workflow.
Does it make sense? Are my remarks understandable enough?