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

Passing Variable via BridgeTalk

Participant ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

Hello,

I'm simply trying to send send 2 variables through BT to PS from IA to create a new document of the specified size.  Why isn't this working, please?  It works fine if I substitute numbers for the variables in the body of the script.

#target illustrator;

var artWidth = 100;

var artHeight = 100;

     

var bt = new BridgeTalk;

      bt.target = "photoshop";         

       var script = "app.documents.add(artWidth,artHeight);"       

       bt.body = script;

       bt.send();

Thank you for saving my sanity, again!

TOPICS
Scripting

Views

77.5K

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

correct answers 1 Correct answer

Community Expert , Jan 29, 2013 Jan 29, 2013

try

var script = "app.documents.add(" + artWidth + "," + artHeight + ");"

Votes

Translate

Translate
Adobe
Community Expert ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

try

var script = "app.documents.add(" + artWidth + "," + artHeight + ");"

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
Participant ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

Works great!  Now, how do I tell Photoshop to make the document in pixels instead of inches?  What I'm trying to do is take the dimension of a selection in Illustrator and have Photoshop make the exact same size document, to which the art from Illustrator will be placed.

Thanks again for your help Carlos, I appreciate it!

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
Community Expert ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

mine was created in pixels, was yours 100 inches?

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
Participant ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

Yes, until I set the Rulers preference to pixels.  It was set to inches, with the type set to pixels.  Now, it works fine.

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
Guru ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

Then you need to include this as part of the photoshop script syntax… You may be able to record Action Manager syntax to create a new document using clipboard bounds…

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
Participant ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

Thanks Mark,

When I initially started on this, I knew that PS gave you the option of using the clipboard for the new document size but, I didn't see anything in the PS Ref about being able to script that option during a document creation.  That's what gave me the idea of pulling the dimensions of the art from illustrator and sending them to PS.

I know zero about scripting PS and I guess I assumed the scripts would automatically work in pixels like AI.  Since I've only really scripted Illustrator (Applescript and now JS), I was suprised at just how much the scripting options differered.

Luckily, I only have to take art from Illustrator into PS and save it as a TIFF (with the options that PS offers over AI).

You mentioned something that I didn't know you could do, though.  Before getting into scripting, I used to record actions for things that they could do.  But, how do you get to the actual code they produce?  Can you use that in scripts?  If so, could you transfer that code into ScriptUI code for use in a palette?  Seems like that would open up alot of options!

Thanks!

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
Community Expert ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

ha!

I know close to nothing about photoshop...but looking at the OMV, I came up with this

var script = "app.preferences.rulerUnits = Units.PIXELS; app.documents.add(" + artWidth + "," + artHeight + ");" 

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
Participant ,
Jan 29, 2013 Jan 29, 2013

Copy link to clipboard

Copied

Works!???

Sent from my iPhone

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
Participant ,
Jan 30, 2013 Jan 30, 2013

Copy link to clipboard

Copied

LATEST

Works like a charm!  Thanks!!

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