|
Yvves Newbie
Joined: 29 Nov 2003 Posts: 9 Location: USA
|
Posted: Fri Jan 30, 2004 12:12 am
Nifty little Text to Morse Code converter |
Here's something I threw together for the hell of it. If you put it in correctly (That is to say, if I wrote it here correctly), it'll give you a nifty little button you press that in turn pops up a dialog box. Input the text you want to convert (no punctuation, however) and click okay, and it will output the morse code for that phrase.
#ALIAS {convert} {
#VAR morse %replace(@morse," ","/ ")
#VAR morse %replace(@morse,a,".- ")
#VAR morse %replace(@morse,b,"-... ")
#VAR morse %replace(@morse,c,"-.-. ")
#VAR morse %replace(@morse,d,"-.. ")
#VAR morse %replace(@morse,e,". ")
#VAR morse %replace(@morse,f,"..-. ")
#VAR morse %replace(@morse,g,"--. ")
#VAR morse %replace(@morse,h,".... ")
#VAR morse %replace(@morse,i,".. ")
#VAR morse %replace(@morse,j,".--- ")
#VAR morse %replace(@morse,k,"-.- ")
#VAR morse %replace(@morse,l,".-.. ")
#VAR morse %replace(@morse,m,"-- ")
#VAR morse %replace(@morse,n,"-. ")
#VAR morse %replace(@morse,o,"--- ")
#VAR morse %replace(@morse,p,".--. ")
#VAR morse %replace(@morse,q,"--.- ")
#VAR morse %replace(@morse,r,".-. ")
#VAR morse %replace(@morse,s,"... ")
#VAR morse %replace(@morse,t,"- ")
#VAR morse %replace(@morse,u,"..- ")
#VAR morse %replace(@morse,v,"...- ")
#VAR morse %replace(@morse,w,".-- ")
#VAR morse %replace(@morse,x,"-..- ")
#VAR morse %replace(@morse,y,"-.-- ")
#VAR morse %replace(@morse,z,"--.. ")
#VAR morse %replace(@morse,A,".- ")
#VAR morse %replace(@morse,B,"-... ")
#VAR morse %replace(@morse,C,"-.-. ")
#VAR morse %replace(@morse,D,"-.. ")
#VAR morse %replace(@morse,E,". ")
#VAR morse %replace(@morse,F,"..-. ")
#VAR morse %replace(@morse,G,"--. ")
#VAR morse %replace(@morse,H,".... ")
#VAR morse %replace(@morse,I,".. ")
#VAR morse %replace(@morse,J,".--- ")
#VAR morse %replace(@morse,K,"-.- ")
#VAR morse %replace(@morse,L,".-.. ")
#VAR morse %replace(@morse,M,"-- ")
#VAR morse %replace(@morse,N,"-. ")
#VAR morse %replace(@morse,O,"--- ")
#VAR morse %replace(@morse,P,".--. ")
#VAR morse %replace(@morse,Q,"--.- ")
#VAR morse %replace(@morse,R,".-. ")
#VAR morse %replace(@morse,S,"... ")
#VAR morse %replace(@morse,T,"- ")
#VAR morse %replace(@morse,U,"..- ")
#VAR morse %replace(@morse,V,"...- ")
#VAR morse %replace(@morse,W,".-- ")
#VAR morse %replace(@morse,X,"-..- ")
#VAR morse %replace(@morse,Y,"-.-- ")
#VAR morse %replace(@morse,Z,"--.. ")
#show @morse
}
Make a button (New - Button)
Make the Caption something like "Text to Morse"
And the Value:
#PR morse "Enter the text you want to convert!"
convert
That outta do it. (Sorry, I don't know the command to make a button from the command line, if there is one) ;)
Now, all you hafta do is click the button titled 'Text to Morse', put in the phrase you want to convert (hello everyone) and click okay. The morse code equivalent will be shown on that window, where you can copy it to the clipboard and do with it what you want. :P
~Yvves |
|
|
|
Yvves Newbie
Joined: 29 Nov 2003 Posts: 9 Location: USA
|
Posted: Fri Jan 30, 2004 12:42 am |
And for kicks, here's morse code to text. ;)
#ALIAS {revert} {
#VAR morse %replace(@morse,"-... ",b)
#VAR morse %replace(@morse,"-.-. ",c)
#VAR morse %replace(@morse,"..-. ",f)
#VAR morse %replace(@morse,".... ",h)
#VAR morse %replace(@morse,".--- ",j)
#VAR morse %replace(@morse,".-.. ",l)
#VAR morse %replace(@morse,".--. ",p)
#VAR morse %replace(@morse,"--.- ",q)
#VAR morse %replace(@morse,"...- ",v)
#VAR morse %replace(@morse,"-..- ",x)
#VAR morse %replace(@morse,"-.-- ",y)
#VAR morse %replace(@morse,"--.. ",z)
#VAR morse %replace(@morse,"-.. ",d)
#VAR morse %replace(@morse,"--. ",g)
#VAR morse %replace(@morse,"-.- ",k)
#VAR morse %replace(@morse,"--- ",o)
#VAR morse %replace(@morse,".-. ",r)
#VAR morse %replace(@morse,"... ",s)
#VAR morse %replace(@morse,"..- ",u)
#VAR morse %replace(@morse,".-- ",w)
#VAR morse %replace(@morse,".. ",i)
#VAR morse %replace(@morse,"-- ",m)
#VAR morse %replace(@morse,"-. ",n)
#VAR morse %replace(@morse,".- ",a)
#VAR morse %replace(@morse,". ",e)
#VAR morse %replace(@morse,"- ",t)
#VAR morse %replace(@morse,"-...",b)
#VAR morse %replace(@morse,"-.-.",c)
#VAR morse %replace(@morse,"..-.",f)
#VAR morse %replace(@morse,"....",h)
#VAR morse %replace(@morse,".---",j)
#VAR morse %replace(@morse,".-..",l)
#VAR morse %replace(@morse,".--.",p)
#VAR morse %replace(@morse,"--.-",q)
#VAR morse %replace(@morse,"...-",v)
#VAR morse %replace(@morse,"-..-",x)
#VAR morse %replace(@morse,"-.--",y)
#VAR morse %replace(@morse,"--..",z)
#VAR morse %replace(@morse,"-..",d)
#VAR morse %replace(@morse,"--.",g)
#VAR morse %replace(@morse,"-.-",k)
#VAR morse %replace(@morse,"---",o)
#VAR morse %replace(@morse,".-.",r)
#VAR morse %replace(@morse,"...",s)
#VAR morse %replace(@morse,"..-",u)
#VAR morse %replace(@morse,".--",w)
#VAR morse %replace(@morse,"..",i)
#VAR morse %replace(@morse,"--",m)
#VAR morse %replace(@morse,"-.",n)
#VAR morse %replace(@morse,".-",a)
#VAR morse %replace(@morse,".",e)
#VAR morse %replace(@morse,"-",t)
#VAR morse %replace(@morse,"/ "," ")
#show @morse
}
And the button - with Caption "Morse to Text"
#PR morse "Enter the morse code you want to revert!"
revert
(For every action, there is an equal but opposite complete waste of my time.)
~Yvves |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|