Re: boolean cruelty
Re: boolean cruelty
- Subject: Re: boolean cruelty
- From: "Mark J. Reed" <email@hidden>
- Date: Tue, 27 Jan 2009 19:23:01 -0500
Concatenation is &, not "and".
You're also missing the close quote. You'll get <a href="filename>
instead of <a href="filename">.
On Tue, Jan 27, 2009 at 7:18 PM, Joshua Whalen <email@hidden> wrote:
> The following script is tormenting me.
> I need to read a list of files in a folder, and convert the list to a page
> of links to those files.
> everything works fine, except when I try to concatenate "<a href=" and
> thefile and ">" and linkname and "</a>"
> I get "cant make "<a href=" (or thefile, or ">" or anything else, for that
> matter) into a boolean.
> Now, it's getting expensive! I've thrown 3 laptops out the window already,
> and sooner or later one of them is going to hit a passerby, and then it's
> going get real expensive (I live on the 5 floor in nyc), or worse.
> Any help? Or should I just imitate my laptops?
> Here's the script:
> global filelist
> global this_file
> global prefix
> global suffix
> global item_a
> global closetag
> on run
> set filelist to (list folder "Macintosh HD:Users:joshua:Sites:demo:" without
> invisibles) as list
> set prefix to "<a href=\""
> set suffix to ">"
> set closetag to "</a>"
> do shell script "touch /Users/joshua/Sites/demo/articles.html"
> set this_file to "Macintosh HD:Users:joshua:Sites:demo:articles.html"
> open for access this_file with write permission
> repeat with i from 1 to count of filelist
> set docname to item i of filelist
> set item_a to (a reference to prefix and docname and suffix and docname and
> closetag)
> my WriteNow(item_a, this_file, true, text)
> end repeat
> close access file this_file
> end run
> on WriteNow(this_data, this_file, append_data, MyFormat)
> try
> set this_file to this_file as string
> if append_data is false then
> set eof of file this_file to 0
> set MyAppend to false
> else
> set MyAppend to true
> end if
> if MyFormat is text then
> write this_data to alias this_file starting at eof
> log " I wrote it as text " & MyAppend & " " & return & this_data & return &
> return
> return true
> else
> if MyFormat is not text then
> write this_data to alias this_file as «class utf8» starting at eof
> log " I wrote it as utf8 " & MyAppend & " " & return & this_data & return &
> return
> return true
> end if
> end if
> on error
> try
> close access file this_file
> beep 12
> end try
> return false
> end try
> end WriteNow
> Joshua Whalen
> email@hidden
> email@hidden
> http://www.panix.com/~joshua/resume.html
> "Vision without action is a day dream,
> Action without vision is a nightmare."
> -- Japanese proverb
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden