What can I script?

Azwaw

Registered
I wish to create a script for replacing certain characters between languages (such as transcribing arabic text to latin letters with diacritical signs) but I thought Script Editor would record pretty much everything I do but it doesn't even record a simple serach an replace-command.

What have I done wrong?
 
So...you want to do Arabic transliteration. A worthy venture, but you'll have a hard time doing it with Script Editor's record command.

You'll first need to make sure that your script is reading the text the right way and that it can read the vowels and consonants in the right order so it transliterates them correctly.

I'll think about it a bit more and see if I can come up with a decent-ish solution. Incidentally, how comfortable are you with the terminal and do you have at least OS X 10.2 and above (I assume yes)?
 
I'll think about it a bit more and see if I can come up with a decent-ish solution. Incidentally, how comfortable are you with the terminal and do you have at least OS X 10.2 and above (I assume yes)?

It feels perfectly comfortable with the terminal, but I don't know nothing about how to use it.

Am I not able to record something as simple as replacing the letter "a" with the letter "b". Script Editor doesn't seem to register anything I do... :-/
 
Mac OS X's UNIX underpinnings comes with several powerful text editors: sed, awk, and perl.

Try this with sed: "sed 's/a/b/g' <filename>"(without the double quotes, of course -- leave the single ones in)

Warning: you file will be directly changed with sed, so make a copy if you wanna practice. That command will replace (as denoted by the 's' character) all occurrences (all occurrences denoted by the 'g' at the end) of the letter 'a' with the letter 'b', going through the file line by line. Without the 'g' on the end, only the first occurrence of 'a' on every line would be replaced with 'b'.

Try looking sed, awk and perl up on Google. You will find there are more than a plethora of tutorials and examples available.
 
Azwaw, I'm studying linguistics at university and this (automated transliteration) would be a very interesting project to work on. I've started a little applet in XCode (using AppleScript).

The only issue with straight replacement is that it won't come out nearly as good as when it's done by a person (at first). For example, the missing vowels.

Also sed will work fine for roman characters, but I'm not certain of it's unicode viability, which is [essentially] required for non-roman characters. I tried making a test file in pico and the unicode-supported Terminal doesn't even understand some of the letters I input...which is a little depressing.
 
Hmm... mike: perhaps changing the Terminal emulation would help with that... I'll research a little bit. If I'm not mistaken, most terminals use vt100 emulation -- and I believe that vt102 is an extension of that with support for different character sets, but I'm not sure...
 
Back
Top