🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #8135

Re: How to paste from clipboard with specified font

#8135
From: Jumbo_Meddley
Date: Fri, 10 Nov 2006 08:55
64 lines
3032 bytes
Hi Shane - I hadn't thought of that. I just saw the PASTE command and thought that would be best.

Okay, I've tried it out and I'm still confused. Why would I use the SELECTION command (or rather, how would I use it)?

I need to grab text from FileMaker, insert it into a document, apply the relevant font and then repeat (for all chosen FM fields and records) - no user interaction, no manually selecting text, just run the script and watch the InDesign document fill up with formatted text....

set applied font of selection to CurrentFont

How would I select the text contents of the variable grabbed from FileMaker? Here's the full code -

tell application "FileMaker Pro"
	if (exists document 1) is false then return
	set the_number_of_records to 3
end tell

-- Loops through FileMaker database and applies GrabField subroutine for each cell of each record
repeat with CurrentRecord from 1 to the_number_of_records
	set CurrentCell to "First"
	set CurrentFont to "Helvetica"
	GrabField(CurrentCell, CurrentRecord, CurrentStyle, CurrentFont)

	set CurrentCell to "Second"
	set CurrentFont to "Italic"
	GrabField(CurrentCell, CurrentRecord, CurrentStyle, CurrentFont)

	set CurrentCell to "Third"
	set CurrentFont to "Impact"
	GrabField(CurrentCell, CurrentRecord, CurrentStyle, CurrentFont)

	set CurrentCell to "Fourth"
	set CurrentFont to "Monaco"
	GrabField(CurrentCell, CurrentRecord, CurrentStyle, CurrentFont)

	set CurrentCell to "Fifth"
	set CurrentFont to "Apple Symbols"
	GrabField(CurrentCell, CurrentRecord, CurrentStyle, CurrentFont)
end repeat

on GrabField(CurrentCell, CurrentRecord, CurrentStyle, CurrentFont)
	-- Takes data from the CurrentCell of the CurrentRecord and applies CurrentFont
	tell application "FileMaker Pro"
		tell document 1
			set CurrentText to cell CurrentCell of record CurrentRecord
		end tell
	end tell

	-- Inserts CurrentText into InDesign and applies CurrentFont
	tell application "Adobe InDesign CS2"
		set aDocument to active document
		tell aDocument
* *******************************************************************

This is where I'm having problems

* *******************************************************************

		end tell
	end tell
	delay 1
end GrabField

I've highlighted the section that's bothering me.... Any suggestions?

Once again, many thanks : )
Technical Details
Message-ID: <3bc239d1.3@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.albasani.net!news.isoc.lu!webcrossing
References: <3bc239d1.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,bb393d40d5117b7
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Jumbo_Meddley@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.albasani.net!news.isoc.lu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: How to paste from clipboard with specified font
Message-ID: <3bc239d1.3@webcrossing.la2eafNXanI>
Date: Fri, 10 Nov 2006 00:55:37 -0800
References: <3bc239d1.-1@webcrossing.la2eafNXanI>
Lines: 6
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit