I got your script and macro to work here. Nicely done, thank you.
I have been trying to change it to fit my needs without success. I have an Applescript that extracts information from DEVONthink and formats it into an HTML list (it is a list of links, basically). I would like to use the custom HTML prompt to display the list. However, I could not find a way to simply make it display whatever text I have stored in another variable. I have read, of course, the wiki section related to this; still, no joy. Whenever I edit the HTML provided in your example, nothing comes up from the variables.
Could you perhaps point me in the right direction here?
Like I said, I have a HTML list and all I want to do is keep the window open displaying it.
If I understand your objective correctly, I see two possible, untested, approaches:
Use AppleScript to construct the HTML code that includes the HTML list, and integrate it into the HTML file that KM needs.
Design the HTML file to use data from KM Variables.
For me, I think #1 would be easier since both the structure (number of links) and the data (text and href) can change. Many many years ago when I was in the web business I basically took this approach, extracting data from a SQL server and building a dynamic web page.
Other than that, you can try looking at other topics her with about html prompt. Try a search on "tags:html_prompt".
Apologies, but here is the thing: I don't know any JavaScript.
To make it very simple, let us assume that I have a variable called theHTML with the following content:
Thanks for sharing your solution.
Makes for a very simple solution.
I had not used the KM HTML Prompt for a while, and not with the floating and resizable options. I have to say I am amazed that you did not need to use any of the special KM HTML that was needed before.
The immediate need I have is to:
Open at a preset size the first time.
When the user closes the window remember the position and size, and use the next that that window is opened.
Do you happen to have that handy? If not, I'm sure I can figure it out.
Oh, one more request: I notice that you use a CSS file stored locally. Any chance you could share that?
Would it be possible for you provide the output of your AppleScript that sets the KM Variable "theHTMLBody", so we could see what is created and test the macro?
Many of us do not have the DevonThink app, and even if we did, not likely to have the data you have in it.