PICAXE CW Message Generator AppleScript Code | |
To view the PICAXE Fox Hunt Controller Schematic Diagrams - return to the KF3G Home Page, go to the 'Radio, & Accessories, specific:' Section; and then, click on the 'Fox Hunt Controller' Link. | |
AppleScript 'PICAXE CW Message Generator.scpt' Source Code |
|
Below is AppleScript Source Code, which can be copied, and then pasted into 'AppleScript Editor.app' [located in the '/Applications/Utilities/' Folder] and 'Run' selected; or, save the Code as a double-clickable 'Applet' (or Application). | |
-- PICAXE CW Message Generator, creates a String of 0's, 1's, and 3's - based on entered Text. -- Written on Mac Mini 1.1, MacOS X 10.6.8, 28 March 2014 -- A generated '1' is DIT, a '3' is DAH, a '0' is a Character Space, and, a '0,0' is a Word Space set nString to "" -- string Variable. -- Obtain String to convert. set tString to text returned of (display dialog "Enter CW Message: " default answer "CQ CQ CQ DE THE FOX WQ0YYY WQ0YYY") repeat with i in tString -- Cycle through Characters of entered string. set iStr to i as string -- Coerce Character to String. set asciiNum to ASCII number iStr if ((asciiNum > 96) and (asciiNum < 123)) then try -- Convert String to uppercase if lowercase; otherwise, and Error is generated - but ignored. set iStr to do shell script ("echo " & iStr & " | awk '{print toupper($0)}'") -- Convert lowercase to uppercase. end try end if -- Convert String to Digits Equivalent. if (iStr is equal to "A") then set nString to nString & "1,3,0," else if (iStr is equal to "B") then set nString to nString & "3,1,1,1,0," else if (iStr is equal to "C") then set nString to nString & "3,1,3,1,0," else if (iStr is equal to "D") then set nString to nString & "3,1,1,0," else if (iStr is equal to "E") then set nString to nString & "1,0," else if (iStr is equal to "F") then set nString to nString & "1,1,3,1,0," else if (iStr is equal to "G") then set nString to nString & "3,3,1,0," else if (iStr is equal to "H") then set nString to nString & "1,1,1,1,0," else if (iStr is equal to "I") then set nString to nString & "1,1,0," else if (iStr is equal to "J") then set nString to nString & "1,3,3,3,0," else if (iStr is equal to "K") then set nString to nString & "3,1,3,0," else if (iStr is equal to "L") then set nString to nString & "1,3,1,1,0," else if (iStr is equal to "M") then set nString to nString & "3,3,0," else if (iStr is equal to "N") then set nString to nString & "3,1,0," else if (iStr is equal to "O") then set nString to nString & "3,3,3,0," else if (iStr is equal to "P") then set nString to nString & "1,3,3,1,0," else if (iStr is equal to "Q") then set nString to nString & "3,3,1,3,0," else if (iStr is equal to "R") then set nString to nString & "1,3,1,0," else if (iStr is equal to "S") then set nString to nString & "1,1,1,0," else if (iStr is equal to "T") then set nString to nString & "3,0," else if (iStr is equal to "U") then set nString to nString & "1,1,3,0," else if (iStr is equal to "V") then set nString to nString & "1,1,1,3,0," else if (iStr is equal to "W") then set nString to nString & "1,3,3,0," else if (iStr is equal to "X") then set nString to nString & "3,1,1,3,0," else if (iStr is equal to "Y") then set nString to nString & "3,1,3,3,0," else if (iStr is equal to "Z") then set nString to nString & "3,3,1,1,0," else if (iStr is equal to "0") then set nString to nString & "3,3,3,3,3,0," else if (iStr is equal to "1") then set nString to nString & "1,3,3,3,3,0," else if (iStr is equal to "2") then set nString to nString & "1,1,3,3,3,0," else if (iStr is equal to "3") then set nString to nString & "1,1,1,3,3,0," else if (iStr is equal to "4") then set nString to nString & "1,1,1,1,3,0," else if (iStr is equal to "5") then set nString to nString & "1,1,1,1,1,0," else if (iStr is equal to "6") then set nString to nString & "3,1,1,1,1,0," else if (iStr is equal to "7") then set nString to nString & "3,3,1,1,1,0," else if (iStr is equal to "8") then set nString to nString & "3,3,3,1,1,0," else if (iStr is equal to "9") then set nString to nString & "3,3,3,3,1,0," else if (iStr is equal to " ") then set nString to nString & "0," else if (iStr is equal to "€") then set nString to nString & "1,3,1,3,0," else if (iStr is equal to "…") then set nString to nString & "3,3,3,1,0," else if (iStr is equal to "†") then set nString to nString & "1,1,3,3,0," else if (iStr is equal to "§") then set nString to nString & "1,1,1,3,3,1,1,0," else if (iStr is equal to "/") then set nString to nString & "3,1,1,3,3,1,0," else if (iStr is equal to ",") then set nString to nString & "3,3,1,1,3,3,0," else if (iStr is equal to "?") then set nString to nString & "1,1,3,3,1,1,0," else if (iStr is equal to ".") then set nString to nString & "1,3,1,3,1,3,0," else if (iStr is equal to ";") then set nString to nString & "1,3,1,3,0," else if (iStr is equal to "=") then set nString to nString & "3,3,3,1,0," else if (iStr is equal to "-") then set nString to nString & "1,1,3,3,0," else if (iStr is equal to "'") then set nString to nString & "1,1,1,3,3,1,1,0," else if (iStr is equal to ":") then set nString to nString & "1,3,1,3,0," else if (iStr is equal to "\"") then set nString to nString & "3,3,3,1,0," else if (iStr is equal to "(") then set nString to nString & "1,1,3,3,0," else if (iStr is equal to ")") then set nString to nString & "1,1,1,3,3,1,1,0," else if (iStr is equal to "$") then set nString to nString & "1,1,1,3,1,1,3,0," else if (iStr is equal to "@") then set nString to nString & "1,3,3,1,3,1,0," else if (iStr is equal to "_") then set nString to nString & "1,1,3,3,1,3,0," else if (iStr is equal to "!") then set nString to nString & "3,3,3,1,0," else if (iStr is equal to "+") then set nString to nString & "1,3,1,3,1,0," else -- Empty Code. end if end repeat set sLen to count nString -- Length of concatenated String. set nString to get (characters 1 through (sLen - 1) of nString) as string -- Remove trailing ',' from concatented String. set nString to "lookup CI, (" & nString & "), CV" -- Encase created String. set the clipboard to nString -- Place new String onto the Clipboard. set sLenDiv to sLen div 2 if ((sLen mod 2) > 0) then sLenDiv + 1 -- Display final Results. display dialog "Locate the Line of Code with 'LL =', and change the Numerical Value to " & (sLenDiv as string) & "." & return & return & "The Text, shown below, has been copied to the Clipboard." & return & return & nString & return & return & "Highlight the 'lookup' Line of Code, and paste the Clipboard's Contents in its place." buttons ("OK") default button "OK" |
|
A compressed File [titled 'PICAXE_CW_Message_Generator.app.zip', 41 KB in Size] of the Application version, of the Source Code above, can be downloaded here. |
|
The Characters a-z, A-Z, ä, Ä, ö, Ö, ü, Ü, ß, 0-9, space, /, ,, ?, ., ;, =, -, ', :, \, (, ), $, @, _, !, + are acceptable. Example. |
|
|
|
Return to AppleScript Code | |
©2008 - 2099, Alle Rechte vorbehalten, SJWL |