Problems writing a Script ! Pls HELP !
Ken Ray
kray at sonsothunder.com
Fri Jun 18 00:38:35 EDT 2004
I would suggest putting all of the morse codes into an array, then iterating
through the array based on the text that is to be converted. Something like
this:
----- CARD SCRIPT
global gMorseA
on openCard
InitializeMorseArray
end openCard
on IntitializeMorseArray
put ".-" into gMorseA["a"]
put "-..." into gMorseA["b"]
put "-.-." into gMorseA["c"]
-- etc.
end InitializeMorseArray
----- BUTTON SCRIPT
on mouseUp
put fld "standardtext" into tText
put "" into tOutput
repeat for each char tChar in tText
put gMorseA[tChar] & "/" after tOutput
end repeat
put tOutput into fld "morsetext"
end mouseUp
HTH,
Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
> -----Original Message-----
> From: metacard-bounces at lists.runrev.com
> [mailto:metacard-bounces at lists.runrev.com] On Behalf Of
> Riddbaba at gmx.de
> Sent: Wednesday, June 16, 2004 4:05 PM
> To: metacard at lists.runrev.com
> Subject: Problems writing a Script ! Pls HELP !
>
>
> Hi,
> I have a Problem ... for school i have to write a little
> program wich translates a normal text into a text written
> with the morse codes ! I have started but i am stuck at the
> point that metacard only translates one single letter ....
> it's really frustrating i have beening trying out everything
> for about 5 days now.... ! (i am using MetaCard for 4 weeks
> now!) I think i have to make some sort of repeat loop so that
> metacard checks every word and then puts the morse cord in
> for each word and doesn'T just put in the code for the last
> letter...PLEASE help me !! I am loosing hope that its even
> possible ...here's my Script sofar ... (only got the letters
> a;b;c cause no üonit of doing every letter if the first three
> ain'T working !
>
> on mouseUp
> put empty into field "morsetext"
> put empty into field "standardtext"
> ask "What would you like to translate?? Was hätten Sie gern
> übersetzt ??"
> if it is not empty then
> set the cursor to watch
> put it into field "standardtext"
> put "it" into field "morsetext"
> put it into filecontent
> repeat for each word w in filecontent
> if "a" is in field "standardtext" then
> put ".- /" into field "morsetext"
> end if
> if "b" is in field "standardtext" then
> put "-... /" into field "morsetext"
> end if
> if "c" is in field "standardtext" then
> put "-.-. /" into field "morsetext"
> end if
> end repeat
> answer "There you go! Bitte Schön!"
> end if
> end mouseUp
>
> Thank You alot ...greets theo !!
>
> --
> +++ Jetzt WLAN-Router für alle DSL-Einsteiger und Wechsler +++
> GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>
More information about the metacard
mailing list