Re: Variable Error
Re: Variable Error
- Subject: Re: Variable Error
- From: Richard Lake <email@hidden>
- Date: Fri, 26 Feb 2010 18:10:41 +0000
Hi,
Without giving you the whole script and associated product data etc..
I shall try recreate an example here and explain the problem I am
having in Applescript code.
set top to my readfile(a file somewhere containing <HTML> ,<head>,
title, meta info etc before main content)
set bottom to my readfile(a file somewhere containing footer eg. </
BODY> and stuff below it)
I use the FindAndReplace routines to replace '||' with quote marks and
replace '~~' with a linefeed; this all works fine. So what we end up
with
is two variables with delimiters of \" where the quote marks are etc.
and nicely paragraphed html code.
code example:
set top to my readfile(a file somewhere containing HTML head data,
title, meta info etc)
set bottom to my readfile(a file somewhere containing footer eg. </
BODY> and stuff below it)
read products from csvs into corresponding arrays
set htmlfile to {}
set bodytext to ""
set end of htmlfile to top
repeat with each product in array
set bodytext to bodytext & the product as a <table> to appear in the
webpage
set bodytext to findandreplace("~~", return, bodytext)
set bodytext to findandreplace("||", quote, bodytext)
set end of htmlfile to bodytext - FAILS here
set end of htmlfile to bottom
at 10th product exit repeat
end repeat
write to disc
----
So now i have 3 variables, top bodytext and bottom which all contain
the applescript marker for a quote mark... \"
htmlfile should contain all 3 parts together.
Now when the program reaches the line ('set end of htmlfile to
bodytext') I get the message: 'Can't set end of htmlfile (html code
in top) to (bodytext).'
Now I have of course used 'return htmlfile' and 'return bodytext' to
ensure they are correct, but I cannot get past this 'Can set end of
htmlfile...' message.
I don't really have a clue why this is happening, I thought it was
something to do with the quote marks in the variables, but I even
commented out the
FindAndReplace calls and still hit the error.
Richard, Beaver Promotions
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden