Creating Guides in a Photoshop document using Python

When doing FX and sprite sheets I like to rule up my document into the correct UV frames before doing any art. Naturally enough, I thought to myself 'Why don't I just script that?'.

Well... it seems that 'guides' are not very natural to Python/VB Photoshop Scripting. Although exposed to Javascript, the guides functionality in Python/VB is just not there.

So after trying multiple ways of asking Photoshop nicely, I decided to try out the scripting listener with the intention of just hacking it in (now its personal!). After plugging in the listener Photoshop kindly supplied me with the required information written in VBs. Now all I've got to do is figure out how to make it into a usable Python script! Stay tuned!

For anyone who is interested, this is what Photoshop sounds like when it mumbles to itself:

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM id43
id43 = objApp.CharIDToTypeID( "Mk  " )
    DIM desc7
    SET desc7 = CreateObject( "Photoshop.ActionDescriptor" )
    DIM id44
    id44 = objApp.CharIDToTypeID( "Nw  " )
        DIM desc8
        SET desc8 = CreateObject( "Photoshop.ActionDescriptor" )
        DIM id45
        id45 = objApp.CharIDToTypeID( "Pstn" )
        DIM id46
        id46 = objApp.CharIDToTypeID( "#Pxl" )
        Call desc8.PutUnitDouble( id45, id46, 256.000000 )
        DIM id47
        id47 = objApp.CharIDToTypeID( "Ornt" )
        DIM id48
        id48 = objApp.CharIDToTypeID( "Ornt" )
        DIM id49
        id49 = objApp.CharIDToTypeID( "Vrtc" )
        Call desc8.PutEnumerated( id47, id48, id49 )
    DIM id50
    id50 = objApp.CharIDToTypeID( "Gd  " )
    Call desc7.PutObject( id44, id50, desc8 )
Call objApp.ExecuteAction( id43, desc7, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM id43
id43 = objApp.CharIDToTypeID( "Mk  " )
    DIM desc7
    SET desc7 = CreateObject( "Photoshop.ActionDescriptor" )
    DIM id44
    id44 = objApp.CharIDToTypeID( "Nw  " )
        DIM desc8
        SET desc8 = CreateObject( "Photoshop.ActionDescriptor" )
        DIM id45
        id45 = objApp.CharIDToTypeID( "Pstn" )
        DIM id46
        id46 = objApp.CharIDToTypeID( "#Pxl" )
        Call desc8.PutUnitDouble( id45, id46, 256.000000 )
        DIM id47
        id47 = objApp.CharIDToTypeID( "Ornt" )
        DIM id48
        id48 = objApp.CharIDToTypeID( "Ornt" )
        DIM id49
        id49 = objApp.CharIDToTypeID( "Vrtc" )
        Call desc8.PutEnumerated( id47, id48, id4
9 )
    DIM id50
    id50 = objApp.CharIDToTypeID( "Gd  " )
    Call desc7.PutObject( id44, id50, desc8 )
Call 
objApp.ExecuteAction( id43, desc7, dialogMode )


No comments:

Post a Comment

Comments?