NerdFencer Posted April 12, 2009 Share Posted April 12, 2009 (edited) Here is a quick script that I wrote to convert text into NATO phonetic (Alfa, Bravo, Charlie, Delta, Echo Foxtrot, Etc...) Its not big (wow, a whole 39 lines!) but it gets the job done. It was written to save me a bit of time, but a friend found it amusing, so I figured I'd post it... expandcollapse popup#NoTrayIcon GUICreate("Whiskey Tango Foxtrot",350,150) GUICtrlCreateLabel("Enter your text in the top box, then click "&Chr(34)&"Convert"&Chr(34)&" to convert it into NATO Phonetic (which will appear in the bottom box)",10,10,330,30) Global $input = GUICtrlCreateInput("Enter Text Here",10,50,330,23) Global $output = GUICtrlCreateInput("Conversion will be here",10,80,330,23) Global $convert = GUICtrlCreateButton("Convert",10,110,100,-1,1) Global $Copy = GUICtrlCreateButton("Copy",240,110,100) Global $TTS = GUICtrlCreateButton("Say",125,110,100) Global $NATO = StringSplit("Alfa |Bravo |Charlie |Delta |Echo |Foxtrot |Golf |Hotel |India |Juliet |Kilo |Lima |Mike |November |Oscar |Papa |Quebec |Romeo |Sierra |Tango |Uniform |Victor |Whiskey |Xray |Yankee |Zulu ","|") Global $objVoice = False, $temp GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $Copy ClipPut(GUICtrlRead($output)) Case $TTS If IsBool($objVoice) Then $objVoice = ObjCreate("SAPI.SpVoice") $objVoice.Volume = 90 $objVoice.Rate = 1 EndIf $objVoice.Speak(GUICtrlRead($output), 1) Case $convert $split = StringSplit(GUICtrlRead($input),"") $combined = "" For $i=1 To $split[0] For $j=1 To $NATO[0] $temp = Asc(StringUpper($split[$i]))-Asc("A")+1 If $temp < UBound($NATO) And $temp>0 Then $split[$i] = $NATO[$temp] Next $combined = $combined & $split[$i] Next GUICtrlSetData($output,$combined) EndSwitch WEnd *Edit - Changed window title to "Whiskey Tango Foxtrot" Edited April 12, 2009 by NerdFencer _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
famaes Posted April 13, 2009 Share Posted April 13, 2009 Nice script, very cool with the voice output. Thank you. (or like they say at NATO : Tango Hotel Alfa November Kilo Yankee Oscar Uniform ) Link to comment Share on other sites More sharing options...
BrettF Posted April 13, 2009 Share Posted April 13, 2009 What about numbers? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
famaes Posted April 13, 2009 Share Posted April 13, 2009 Numbers in the Nato phonetic are spoken out like in English. 1 = one, 2 = two ... So you could convert them, or just leave them... depends on what you need, text or speech. Link to comment Share on other sites More sharing options...
BrettF Posted April 13, 2009 Share Posted April 13, 2009 I learnt it like... Wun Two Three Four Five Six Seven Eight Niner Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
famaes Posted April 13, 2009 Share Posted April 13, 2009 My mistake, after consulting Wikipedia, i see that the pronunciation of numbers is like yours. Guess i learned it wrong. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted April 13, 2009 Share Posted April 13, 2009 I was thinking about doing something like this the other day but decided not to. So I used yours to make it. I didn't make it so the speak works, I could use system beep, but ehhhh don't feel like it Morse Code expandcollapse popup#NoTrayIcon GUICreate("Whiskey Tango Foxtrot",350,150) GUICtrlCreateLabel('Enter your text in the top box, then click "Convert" to convert it into Morse Code (which will appear in the bottom box)',10,10,330,30) Global $input = GUICtrlCreateInput("Enter Text Here",10,50,330,23) Global $output = GUICtrlCreateInput("Conversion will be here",10,80,330,23) Global $convert = GUICtrlCreateButton("Convert",10,110,100,-1,1) Global $Copy = GUICtrlCreateButton("Copy",240,110,100) Global $TTS = GUICtrlCreateButton("Say",125,110,100) Global $NATO = StringSplit(".- |-... |-.-. |-.. |. |..-. |--. |.... |.. |.--- |-.- |.-.. |-- |-. |--- |.--. |--.- |.-. |... |- |..- |...- |.-- |-..- |-.-- |--.. ","|") Global $objVoice = False, $temp GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $Copy ClipPut(GUICtrlRead($output)) Case $TTS If IsBool($objVoice) Then $objVoice = ObjCreate("SAPI.SpVoice") $objVoice.Volume = 90 $objVoice.Rate = 1 EndIf $objVoice.Speak(GUICtrlRead($output), 1) Case $convert $split = StringSplit(GUICtrlRead($input),"") $combined = "" For $i=1 To $split[0] For $j=1 To $NATO[0] $temp = Asc(StringUpper($split[$i]))-Asc("A")+1 If $temp < UBound($NATO) And $temp>0 Then $split[$i] = $NATO[$temp] Next $combined = $combined & $split[$i] Next GUICtrlSetData($output,$combined) EndSwitch WEnd Giggity Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now