Setting PowerPoint font color with Apple Script - applescript

I'm trying to use Apple script to set the font color of all selected PowerPoint shapes. I used something similar to this to set fill and line color, but I haven't been able to get it to work for font color.
tell application "Microsoft PowerPoint"
set theShapeRange to shape range of selection of active window
set n to (count shapes of theShapeRange)
repeat with i from 1 to n
tell shape i of theShapeRange
set font color of text range of it to {99, 99, 99}
end tell
end repeat
end tell

Based on the guidance provided by Mockman in a comment above, this seems to work.
tell application "Microsoft PowerPoint"
set theShapeRange to shape range of selection of active window
set n to (count shapes of theShapeRange)
repeat with i from 1 to n
tell shape i of theShapeRange
set font color of font of text range of text frame of it to {99, 99, 99}
end tell
end repeat
end tell

Related

Changing the bounds of a window

I need help with Apple script. I don't expert in this matter. The script is this:
(*
This Apple script will resize any program window to an exact size and the window is then moved to the center of your screen.
Specify the program name, height and width below and run the script.
Written by Amit Agarwal on December 10, 2013
*)
set theApp to "Finder"
set appHeight to 412
set appWidth to 678
tell application "Finder"
set screenResolution to bounds of window of desktop
end tell
set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution
tell application theApp
activate
reopen
set yAxis to (screenHeight - appHeight) / 2 as integer
set xAxis to (screenWidth - appWidth) / 2 as integer
set the bounds of the first window to {xAxis, yAxis, appWidth + xAxis, appHeight + yAxis}
tell application "Finder" to set the sidebar width of every Finder window to 142
end tell
I would like to resize Finder, but without center it in the screen. Is it possible?
The logic is, you get the current bounds of the front window. The first two items in the bounds are the starting horizontal point on the x axis and the starting vertical point on the y axis. (in other words, the first two items are the coordinates of the top left corner)
Once you have those, you set new bounds, keeping the first two items in the bounds description the same, and then adding the desired width and height to the second two points to resize the window.
set theApp to "Finder"
set appHeight to 412
set appWidth to 678
tell application theApp
activate
set {startHoriz, startVert, endHoriz, endVert} to bounds of the first window
set the bounds of the first window to {startHoriz, startVert, startHoriz + appWidth, startVert + appHeight}
end tell
tell application "Finder" to set the sidebar width of every Finder window to 142
If you wanted to move the window all the way to the left, you could change the startHoriz to 1 before setting the bounds of the window.

How to change the color of selected shape in group in powerpoint using applescript?

When i am grouped the n shapes in one group, and selected one shape from group and changed the color, but its changing color of all shapes in that group, how to overcome this jack? ,I need to change the color of that specific shape from that group
Below code changing all shapes color
tell application "Microsoft PowerPoint"
activate
set theShapeRange to shape range of selection of active window
set selected to child shape range of selection of active window
set n to (count shapes of theShapeRange)
repeat with i from 1 to n
tell shape i of theShapeRange
set fore color of fill format of it to {14, 235, 5}
set back color of fill format of it to {14, 235, 5}
end tell
end repeat
end tell
I suspect this is not possible with AppleScript.
The selection property of PowerPoint (2011) returns the grouped shapes as a single object but there is no information about the selection of a specific shape within the group.
the contents of child shape range specifies also the group.

Change Finder folder background color AppleScript

I'm trying to change the background color of Finder within a repeat loop.
tell application "Finder"
set windowCount to (count windows)
if windowCount > 0 then #check if windows are available
set bgcolor to {65535, 0, 32896}
repeat 10 times
tell the icon view options of window 1
set the background color to {some item of bgcolor, some item of bgcolor, some item of bgcolor}
delay 0.1
end tell
end repeat
end if
end tell
I know I'm missing something simple here. I got it to work in other contexts (outside the loop)...
If you close and reopen your Finder window manually the background changes! According to this question from yesterday the solution is to re-open the window (aka open a new window and close the old) to "refresh" the view:
tell application "Finder"
set windowCount to (count windows)
if windowCount > 0 then #check if windows are available
set bgcolor to {65535, 0, 32896}
repeat 10 times
tell the icon view options of window 1
set the background color to {some item of bgcolor, some item of bgcolor, some item of bgcolor}
end tell
try
set w to front window
tell (make new Finder window)
try
set target to (get target of w)
end try
set bounds to (bounds of w)
set current view to (current view of w)
end tell
tell w to close
end try
delay 0.1
end repeat
end if
end tell
Enjoy, Michael / Hamburg

Applescript w/Keynote. Accessing shapes within a slide

I have a templated Keynote file with some slides and all the slides each have 2 shapes in them. I want to be able to say something like, "hey give me shape 2 of slide 2". The purpose of this, is so that i can add text items directly to that shape. below is the code that I have right now.
I am using the latest Keynote 6.5.2 & Yosemite.
tell application "Keynote"
activate
tell document 1
set anniversary to "Anniversaries"
set myShape to shape 2 of slide 2
tell myShape
set thisTextItem to make new text item with properties {object text:anniversary}
#log thisTextItem
tell thisTextItem
set the size of its object text to 144
set the color of its object text to "blue"
end tell
end tell
end tell
end tell
I can tell slide 2 by itself and of course i get a big text item for slide 2 with text "Anniversaries" and colored blue but its only slide 2... not within shape 2 of slide 2.
With this code it gives me a pop up error when running the script:
Result:
error "Keynote got an error: Can’t make or move that element into that
container." number -10024
what does this mean? do i not have access to shapes within slides?? Any help/info/examples of setting text within a shape that is within a slide would be beneficial. Thanks!
You can set the properties of the text in a shape, you can't insert a text item object in a shape.
tell application "Keynote"
tell document 1
tell shape 2 of slide 2
set object text to "Anniversaries"
tell object text
set it's size to 44
set it's color to {0, 0, 65535} -- blue
end tell
end tell
end tell
end tell

Applescript to change illustrator colors

I'm trying to change a colour in an illustrator document from one color the another heres what i've got but it keeps saying "can't find color" i'm not sure what i'm doing wrong?
tell application "Adobe Illustrator"
if exists color is equal to "C=0 M=0 Y=0 K=90" then
set color to "C=0 M=0 Y=0 K=100"
end if
end tell
tell application "Adobe Illustrator"
set allMyItems to every path item of current document whose fill color is {cyan:0.0, magenta:0.0, yellow:0.0, black:90.0}
repeat with myItem in allMyItems
set fill color of myItem to {cyan:0.0, magenta:0.0, yellow:0.0, black:100.0}
end repeat
end tell
Looks like it cant understand what exactly color are you setting (i.e. fill color, stroke color, etc.). Or if you just setting a variable named 'color' than you probably need to choose another name (something like myColor) because this one is reserved

Resources