Pingtype Scripting

If you're not a programmer, go back to the

Query strings

If you want to send text to Pingtype, you can use query strings (like GET in PHP, but actually I implemented it in JavaScript). The supported commands are:

text

  Description: Some text, in Chinese or bilingual. It will be copied to the ChineseTextArea, spaced and translated.

  Example: pingtype/index.html?text=星期二我在我家里為她做飯

chineseFile, englishFile

  Description: URLs of text files for Chinese (required) and English text (optional).

  Example: pingtype/index.html?chineseFile=passportStickerChinese.txt&englishFile=passportStickerEnglish.txt

command

  Description: A function name in the Pingtype code, with any parameters if needed. See the Pingtype source code for a list of functions.

  Example: pingtype/index.html?command=advancedButtonClicked();

AppleScript

My native language is AppleScript. I learned it by myself when I was about 13, and I still use it often. In fact, Pingtype started life as an AppleScript until I ported it to JavaScript.

Controlling Pingtype must still be done using JavaScript, but you can trigger that from AppleScript. For example:

tell application "Safari"

  tell front document

   set translated_html to do JavaScript "document.getElementById(\"outputHtml\").innerHTML;"

  end tell

end tell

The CNLT Parallel Literal Bible.scpt script is used for automatic Bible translation. It would be possible to edit it for other data sources. If you're really planning to do this though, then please get in touch and we can talk about it.