Re: Missing property in PowerPoint dictionary!?
Re: Missing property in PowerPoint dictionary!?
- Subject: Re: Missing property in PowerPoint dictionary!?
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 09 Aug 2005 08:57:41 -0700
- Thread-topic: Missing property in PowerPoint dictionary!?
On 8/9/05 7:03 AM, "email@hidden" <email@hidden> wrote:
>
>> 'do Visual Basic' still works:
>>
>> tell application "Microsoft PowerPoint"
>> do Visual Basic "ActivePresentation.Slides(1).Shapes(2).TextFrame_
>> .TextRange.ParagraphFormat.SpaceBefore = 6"
>> end tell
>
> This works for setting the property, but how about getting it?
> What I do now is this (please, no laughing...):
> 1. Use AS to create shape named "temp"
> 2. Use VB to get the space before value from the text I want
> 3. Use VB to set the content of the "temp" shape to the space before value
> 4. Use AS to get the content of the "temp" shape
> 5. Use AS to delete the "temp" shape
>
> Any better ideas?
Ah, yes, back to the old tricks needed before Office 2004. To get a value
returned from 'do Visual Basic', what I would do would be to coerce it to
string (if it isn't string already) and write it to a text file from 'do
Visual Basic', then read it back in AS. VB's Open for Output and Print # are
exactly like AS's open for access with write permission and write, except
you have to get the File Number (like the result of open for access) first
via FreeFile method. (In VB a single quote ' is used for comments.)
Like this:
set tempFilePath to ((path to temporary items as string) & "Shared Text
File")
set vbTextFilePath to "\"" & tempFilePath & "\""
tell application "Microsoft PowerPoint"
do Visual Basic "
Dim spb As Integer, FileNumber As Integer
spb = ActivePresentation.Slides(1).Shapes(2).TextFrame_
.TextRange.ParagraphFormat.SpaceBefore
'write spb as string to text file, replacing any text there
FileNumber = FreeFile
Open " & vbTextFilePath & " For Output As #FileNumber
Print #FileNumber, CStr(spb) ' coerce spb to string and write
Close #FileNumber
"
end tell
set spb to (read alias tempFilePath) as integer
and continue on from there.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden