Counting Lines

Paul Foraker paul at whitefeather.com
Sun Jan 12 17:35:21 EST 2014


I have a WordPress form on my website that sends me an email when someone
fills it out. I've written a stack that parses that email into
tab-delimited lines for pasting into a spreadsheet. On the Mac (iMac,
10.7.5), but not on the PC (Vista), LiveCode is discarding a blank line in
the data.

Here is the raw Data as copied from Firefox in Gmail and pasted into BBEdit
(which, curiously, discards the bullets in the list):
==========
Wait List
On: Jan 9, 2014 @ 12:28 PM
IP: 98.207.89.163

    First Name: That
    Last Name: Guy
    Address 1: 5427 Streetname
    Address 2:
    City: Newark
    State/Province: CA
    ZIP/Postal Code: 94560
    Country: US
    Phone Number: 408-555-1212
    Email Address: somebody at yahoo.com
==========

Counting the blank line, there are 14 lines in that data. When I copy it
from Firefox to the Clipboard and then ask LC how many lines there are in
the data, it comes back with 13 on my Mac. When I put it into a fld, the
line count is 13.

On my customer's PC, the line count = 14.

Here is the data after processing on the Mac in LiveCode to prepend line
numbers. Note the missing empty line (and the bullets, curiously, are
preserved).
===========
1 Wait List
2 On: Jan 9, 2014 @ 12:28 PM
3 IP: 98.207.89.163
4 • First Name: That
5 • Last Name: Guy
6 • Address 1: 5427 Streetname
7 • Address 2:
8 • City: Newark
9 • State/Province: CA
10 • ZIP/Postal Code: 94560
11 • Country: US
12 • Phone Number: 408-555-1212
13 • Email Address: somebody at yahoo.com
===========
Here is the script that appends the line numbers:

on testLines
   put getClip() into theLines
   repeat with i = 1 to the number of lines in theLines
      put i &tab before line i of theLines
   end repeat
   setClip theLines
end testLines

-- getClip() and setClip are clipboardData["text"] handlers in use.

So: On the PC, LiveCode counts 14 lines. On the Mac, it discards the blank
line and counts 13 lines.

Apparently, I need to write different parsing functions for the platforms.

Is this a bug, or am I missing something? Or both. :)

-- Paul



More information about the use-livecode mailing list