• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Add new document from clipboard

Explorer ,
Nov 13, 2008 Nov 13, 2008

Copy link to clipboard

Copied

Hi scripters

The following script works fine,

Set appRef = CreateObject("Photoshop.Application")

Set docRef = appRef.Documents.Add

docRef.paste()

but the new document size is default photoshop size, but i want to create new document from clipboard

how i can do this?

thanks in advance

regards
a r u l
TOPICS
Actions and scripting

Views

914

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Nov 13, 2008 Nov 13, 2008

Copy link to clipboard

Copied

Taken from scriptlistner..

DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idMk
idMk = objApp.CharIDToTypeID( "Mk " )
DIM desc5
SET desc5 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idNw
idNw = objApp.CharIDToTypeID( "Nw " )
DIM desc6
SET desc6 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idpreset
idpreset = objApp.StringIDToTypeID( "preset" )
Call desc6.PutString( idpreset, "Clipboard" )
DIM idDcmn
idDcmn = objApp.CharIDToTypeID( "Dcmn" )
Call desc5.PutObject( idNw, idDcmn, desc6 )
Call objApp.ExecuteAction( idMk, desc5, dialogMode )
DIM idpast
idpast = objApp.CharIDToTypeID( "past" )
DIM desc3
SET desc3 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idAntA
idAntA = objApp.CharIDToTypeID( "AntA" )
DIM idAnnt
idAnnt = objApp.CharIDToTypeID( "Annt" )
DIM idAnno
idAnno = objApp.CharIDToTypeID( "Anno" )
Call desc3.PutEnumerated( idAntA, idAnnt, idAnno )
Call objApp.ExecuteAction( idpast, desc3, dialogMode )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 13, 2008 Nov 13, 2008

Copy link to clipboard

Copied

Hi Paul

Thanks for your reply, but the code is not working for me. I am using photoshop cs2 windows xp

I have just copy and pasted a.vbs, when I executed a.vbs its throwing error Illegal argument

where i am mistaken

thanks

regards
a r u l

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 13, 2008 Nov 13, 2008

Copy link to clipboard

Copied

Yes I see the problem, that being this forum removes some spaces that are vital to the code!
Lines.
idMk = objApp.CharIDToTypeID( "Mk " )
idNw = objApp.CharIDToTypeID( "Nw " )

These need to be changed the "Mk " should be "Mk space space" and
"Nw " should be "Nw space space"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 13, 2008 Nov 13, 2008

Copy link to clipboard

Copied

LATEST
Great job Paul

Thanks you so much I am new to vbscript, I am a javascripter, now the script works good

thanks again

regards
a r u l

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines