Skip to main content
Known Participant
May 27, 2014
Answered

"Type Options" in "Document Setup" scriptable?

  • May 27, 2014
  • 2 replies
  • 540 views

I would like to create a script (have not done one before) that changes the values of the superscript and subscript size/position in "Document Setup". After looking around, I did not see anything even related to this and only a comment on one site that it probably could not be done. So it this a lost cause? I have many files I would like to convert the values for.

Thanks.

This topic has been closed for replies.
Correct answer CarlosCanto

I couldn't make Ctrl work either, but this works, save as vbs and run inside Illustrator

this changes the superscript default value of 58.3 to 60

Set objShell = CreateObject("WScript.Shell")

objShell.SendKeys "%F"

objShell.SendKeys "D"

objShell.SendKeys "%P"

objShell.SendKeys "60"

objShell.SendKeys "{ENTER}"

2 replies

Brian2025Author
Known Participant
May 27, 2014

I am on windows and tried SendKeys. I am pretty close, but the CNTRL and ALT modifiers don't seem to work. It works in notepad and Word, but Illustrator does not seem accept the modifier. For example, I try to just do a select all here (via WshShell.SendKeys "^a") but it just goes to the direct select tool (keyboard shortcut "a") instead.

I just created and executed a test.wsf file:

   <job id="vbs">

      <script language="VBScript">

        ' Open Illustrator

        Set WshShell = CreateObject( "WScript.Shell" )

        WshShell.Run "Illustrator"

               

               For testing purposes, Word does the select all correctly

                'WshShell.Run "WinWord"

        ' Give two seconds to load/observe

        WScript.Sleep 2000

        'Activate Select Tool

        WshShell.SendKeys "V"

       

        'Activate Pen Tool

        WScript.Sleep 2000

        WshShell.SendKeys "P"

       

        'Select All

        WScript.Sleep 2000

        WshShell.SendKeys "^a"

      </script>

   </job>

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
May 27, 2014

I couldn't make Ctrl work either, but this works, save as vbs and run inside Illustrator

this changes the superscript default value of 58.3 to 60

Set objShell = CreateObject("WScript.Shell")

objShell.SendKeys "%F"

objShell.SendKeys "D"

objShell.SendKeys "%P"

objShell.SendKeys "60"

objShell.SendKeys "{ENTER}"

Brian2025Author
Known Participant
May 27, 2014

This works too. Thanks. Though it was strange. On my end the "%P"  command cause the units to change to pixels instead of tabbing to the right position. But that is OK since I just inserted a series of tabs.

It looks like the real problem is that the CNTRL function does not work, which the ALT does. So you found a clever way to get around that. I think I will still use the SendKeys approach as I did in the 3rd post (but using ALT like you did). The reason is that is it easier to launch the script by just double clicking instead of picking it form a drop down menu.

Anyway, thanks for the tip! This is will work great.

CarlosCanto
Community Expert
Community Expert
May 27, 2014

I didn't find a way to change it either, if you're on windows "send keys" is always an option