Hi, I've got a script that I'm using to strip HTML code out of text. The script works fine when run from the Script Editor, but alas, when run from inside Filemaker (9 Advanced, on a Mac Pro running Leopard) it throws errors when I try to use the script, or compile it when pasting it into a "perform applescript" script step. The exact script I'm using is below, and it works perfectly when run from the script editor, outputting the proper text without HTML tags. However, it refuses to compile in FMpro, showing "Expected end of line, found identifier" at the word "theText" in "write theText to ff". If I comment this line out, it then complains about the word "file" in "set theText to paragraphs of (read file temp as Unicode text)". Is there anything about the script that would make Filemaker refuse to work with it even though it fundamentally works?
The script: property sampleText : true -- set to false to read an example from epguides.com set temp to ((path to temporary items as Unicode text) & "html_test.txt") set Ptemp to quoted form of POSIX path of temp if sampleText then -- either create a sample text file set theText to "New manga featuring <a href='/search/mogudan'>Brave Soul</a> artist Mogudan. " set ff to open for access file temp with write permission write theText to ff close access ff else -- or read a web page with curl do shell script "curl http://epguides.com/ATeam/ -o " & Ptemp end if -- convert html to txt do shell script "textutil -format html -inputencoding iso-8859-1 -convert txt -encoding UTF-16 " & Ptemp set theText to paragraphs of (read file temp as Unicode text) do shell script "rm " & Ptemp -- delete tempfile try set the clipboard to (theText) as string on error errMsg display dialog errMsg end try
