inserting variable files into indesign

hi,

I am trying to write a script that can import files such as xls and txt in indesign. I am able to do so, if the file is not a variable.

First i try to open finder to select the file whereafter the file automaticly places itself in the document.

the code i have for the txts (which doesn’t work :s):


tell application "Adobe InDesign CS3"
	set myDocument to make document
	set myDocument to (choose file with prompt "Choose your text file")
	tell application "Finder"
		set myText to (container of myDocument) as text
	end tell
end tell

tell application "Adobe InDesign CS3"
	set mySpread to active spread of active window
	tell mySpread
		set myTextFrame to make text frame
		tell myTextFrame
			set geometric bounds to {"10", "10", "287", "200"}
		end tell
	end tell
end tell

set tempfilepath to (myText) as text
set MyHead to "blah-blah-blah"
tell application "Adobe InDesign CS3"
	tell myDocument
		place tempfilepath in myTextFrame
	end tell
end tell

when i am able to make this work… it is my intention to do it for as well xls as txt with the same script… any suggestions…

I don’t understand what you’re trying to do and what isn’t working. You want to import an Excel sheet into a table in InDesign? What do you mean “if the file is not a variable”?

I am by no means a skilled InDesign scripter, but is this what you are trying to do?

set myFile to (choose file with prompt "Choose your text file") as text

tell application "Adobe InDesign CS3"
	activate
	set myDocument to make document
	set mySpread to active spread of active window
	tell mySpread to set myFrame to make rectangle with properties {geometric bounds:{"10", "10", "287", "200"}}
	tell myFrame to place myFile
end tell

yeees, thank you… looks like it works…