Unlock All

This is my first time trying to write an applescript for adobe illustrator so I am trying something simple. All I want to do is do a select all create outlines. But I need an if statement such as if there are locked items do this if there are no locked items do this.

tell application “adobe illustrator”
If items are locked then unlock all (command option 2) then
select all
else
select all
end if
create outlines (command shift O)
end tell

Why check, why not just try to unlock all regardless?

Can you give me a code example on how that would work

Unfortunately I don’t have Illustrator to test this but based on Illustrator’s dictionary, found right here at MacScripter, I think the following may get you closer. I am unsure on how to select all.

tell application "adobe illustrator" 
set selection of every text art item to true
--or 
set selected of every text art item to true
--or using Sandi's addition
tyoetext "a"

convert to paths selected items
--or
convert to paths selection
--or using Sandi's addition
typetext "o" with command and shift
end tell

Again, I don’t have Illustrator to confirm this. Hope it helps anyway

when I run this code it keeps erroring out Can’t set selection of every text art item to true.


tell application "Adobe Illustrator"
    activate
    set selection of every text art item to true
    convert to paths selection
end tell

Assuming you are using Illustrator 10, this seems to work even if items are locked:

Jon