How to remove a carriage return from a field?
Lynch, Jonathan
bnz2 at cdc.gov
Thu Jan 19 17:11:31 EST 2006
Hi Claire,
If you are building a file name, you might need to watch out for more
than just linefeeds.
Filenames generally should be limited to letters, numbers, and
underscore (hyphen is usually ok too)
You can be strict about this using the keydown and rawkeydown handlers.
It would look like this:
On RawKeyDown pKey
Put "abcdefghijklmnopqrstuvwxyz1234567890_-" into tCharList
If ((the commandkey is down) and (numtochar(pkey)="v")) or (pKey =
65379) then
Put the clipboarddata["text"] into tPastedText
Repeat for each char tChar in tPastedText
If tChar is in tCharList then put tChar after tNewPastedText
End repeat
Put tNewPastedText into the selection
Else
Pass rawkeydown
End if
End RawKeyDown
On Keydown pKey
Put "abcdefghijklmnopqrstuvwxyz1234567890_-" into tCharList
If pKey is in tCharList then pass keydown
End keydown
A couple notes
1) it is untested, let me know if it does not work and I will fix it for
you.
2) 65379 is the raw key number for the insert key on a typical windows
keyboard. This might be different on your keyboard.
Good luck,
Jonathan
-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Martin
Baxter
Sent: Thursday, January 19, 2006 4:38 PM
To: How to use Revolution
Subject: Re: How to remove a carriage return from a field?
Claire Bradin Siskin wrote:
> In my stack, the user enters identifying information into a field, and
> this text is used to build a filename for ftp upload. This works fine
as
> long as the user does not enter a carriage return at the end of the
> field. If the user does press "enter," this messes up the upload. How
> can I script it so that any carriage returns are removed from the
field?
>
> Suggestions for actual scripts would be very much appreciated since I
am
> a newbie. :-)
>
> Thanks very much,
or this field script:
on closefield
put line 1 of me into me
end closefield
Martin
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list