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

Placed item Wild Card

Explorer ,
Dec 12, 2016 Dec 12, 2016

Copy link to clipboard

Copied

I have been trying unsuccessfully to change this command to a wild card statement for files in this folder... I may be mixing two different scripting styles together but not sure...  Creating a Hot folder that will grab files as they are placed in folder... Have it working successfully when I use a generic file.opendialog option but want it to grab the file from the folder...

Help Please...

//This is just the place portion of my entire script...

//Place New Image

var image = File('~/Desktop/Files/*.*');

var newimage = docRef.placedItems.add(); 

newimage.file = image; 

newimage.position = [200,-300];

TOPICS
Scripting

Views

298

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

People's Champ , Dec 13, 2016 Dec 13, 2016

Declaring a File instance imply to specifically path an url to a File whatever it exists or not at the time.

You can't use such a shortcut for getting any files of the folder. Instead you may want to use Folder.getFiles()

//Place New Image

var fo = Folder ( '~/Desktop/Files' );

var files = fo.getFiles ( /* you may want to use a filter function here. See doc */ );

var file, newimage;

while ( file = files.pop() ) {

  newimage = docRef.placedItems.add();

  newimage.file = file;

  newimage.position = [200,

...

Votes

Translate

Translate
Adobe
People's Champ ,
Dec 13, 2016 Dec 13, 2016

Copy link to clipboard

Copied

LATEST

Declaring a File instance imply to specifically path an url to a File whatever it exists or not at the time.

You can't use such a shortcut for getting any files of the folder. Instead you may want to use Folder.getFiles()

//Place New Image

var fo = Folder ( '~/Desktop/Files' );

var files = fo.getFiles ( /* you may want to use a filter function here. See doc */ );

var file, newimage;

while ( file = files.pop() ) {

  newimage = docRef.placedItems.add();

  newimage.file = file;

  newimage.position = [200,-300];

}

HTH

Loic

Ozalto | Productivity Oriented - Loïc Aigon

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