Scripting / Actions
Join the #1 Art Workshop - LevelUpJoin Premium Art Workshop

Results 1 to 5 of 5

Thread: Scripting / Actions

  1. #1
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    283
    Thanks
    41
    Thanked 58 Times in 45 Posts
    Follows
    0
    Following
    0

    Scripting / Actions

    I've been looking through the scripting guides and the scripting VB Ref file that comes with Photoshop.
    I do know some basics of VB and I'm trying to make a script which makes a new file similar to this:



    This is simply a basic setup I use for drawing thumbnails

    And this is what I've got so far:

    Code:
    Dim appRef
    Set appRef = CreateObject( "Photoshop.Application" )
    
    ' Remember current unit settings and then set units to the value expected by this script
    Dim originalRulerUnits
    originalRulerUnits = appRef.Preferences.RulerUnits
    ' 1 = pixels
    ' 2 = inches
    ' 3 = ??
    appRef.Preferences.RulerUnits = 1
    
    ' Create a new 1600x1200 inch document and assign it to a variable
    Dim docRef
    Dim artLayerRef
    Dim textItemRef
    Set docRef = appRef.Documents.Add(1600, 1200)
    
    ' Create a new art layer containing text
    Set artLayerRef = docRef.ArtLayers.Add
    
    '............
    
    
    ' Restore unit setting
    appRef.Preferences.RulerUnits = originalRulerUnits
    So I'm wondering how you can select something using the marque tool
    (probably by inserting coordinates as pixels) and then filling it in with the paint bucket tool.

    OR If anyone knows how to reach this through using actions, I'm very willing to learn how.

    PS: I've already tried the adobe forums, no similar question was found there.

    -Tom

    Reply With Quote Reply With Quote  

  2. #2
    Join Date
    Apr 2007
    Location
    Poland, Warsaw
    Posts
    574
    Thanks
    27
    Thanked 172 Times in 103 Posts
    Follows
    0
    Following
    0
    I've tried with actions and I think I got what you want.

    Create new action and do these things:

    1). click on rectangle selection tool
    2). click CTRL+A to select whole canvas
    3). right mouse button on canvas area and select Transform selection
    4). while holding ALT (it allows to transform selection symmetrically) , make selection smaller to get outer frame
    5). enable the selection option that allows to cut parts of selection (Remove/Cut from selection, or something, I don't have English language version) in top bar
    6). cut out these parts where you want to have internal frames (I don't know how to make it accurately, so I did it with my eye)
    7). invert selection (Selection > Invert)
    8. fill with black colour
    9). disable selection (CTRL+D hotkey)

    And that's all. Tested and works fine. But only with 1600x1200 resolution. You could also put creating documents in actions. And even assign actions set to Photoshop launch events (File > Scripts > Scripts manager and there you play). I mean, every time Photoshop is launched, it will trigger this actions set.

    Reply With Quote Reply With Quote  

  3. The Following User Says Thank You to Tonic For This Useful Post:


  4. #3
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    283
    Thanks
    41
    Thanked 58 Times in 45 Posts
    Follows
    0
    Following
    0
    Thank you tonic, I managed to get it that way aswell, it only took me a time to understand actions can't work on the basic "Background" layer, so you first need to make a new layer.

    Anyone knows how to script this? I would love to have it also as a script (also for better understanding of the script.)

    Reply With Quote Reply With Quote  

  5. #4
    Join Date
    Feb 2006
    Location
    NYC
    Posts
    1,008
    Thanks
    175
    Thanked 696 Times in 292 Posts
    Follows
    0
    Following
    0
    There's a chapter in the Photoshop Scripting guide called "Selections". Within that there's a section called "Defining Selections", and a section called "Filling a selection". Both have examples which should pretty much get you what you want. If you have questions let me know, but I've never used VB (only JavaScript) so I might not be able to help you with the exact syntax.

    Reply With Quote Reply With Quote  

  6. #5
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    283
    Thanks
    41
    Thanked 58 Times in 45 Posts
    Follows
    0
    Following
    0
    Thank you, didn't notice they got those chapters,
    I searched the PDF's with "ctrl + f" but seems i used wrong keywords.

    Reply With Quote Reply With Quote  

Members who have read this thread: 0

There are no members to list at the moment.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •