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

Using Script to Create sub-folder using variable as name - need help

Participant ,
Jul 06, 2023 Jul 06, 2023

I have an image in folder in download\TEST, I want create a new sub-folder in test and save image to it

var myDocument = activeDocument;
var f = new Folder(myDocument.path+theResult.join("X"))

if (!f.exists) {

    f.create();

theResult.join("X") is a variable stored values from another function whitch is 2X3, above code created folder

download\TEST2X3 instead download\TEST\2x3 (result I want)

 

How to fix it ? thank you

 

 

 

TOPICS
Actions and scripting , Windows
345
Translate
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
Community Expert ,
Jul 06, 2023 Jul 06, 2023

@Calvin21914323wi10 I'm gonna put money down that @Stephen Marsh is the guy to help you with this one!

Translate
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 ,
Jul 06, 2023 Jul 06, 2023

@Sef McCullough â€“ thanks, no pressure! 

 

There are many scripters here who I believe can also help...

 

Translate
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 ,
Jul 06, 2023 Jul 06, 2023

@Calvin21914323wi10 â€“ Untested, but perhaps:

 

var f = new Folder(myDocument.path+"/"+theResult.join("X"));

 

Or:

 

var f = new Folder(myDocument.path+"\\"+theResult.join("X"));

 

Translate
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 ,
Jul 08, 2023 Jul 08, 2023

Second one, works, thank ou very much

Translate
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 ,
Jul 08, 2023 Jul 08, 2023
LATEST

@Calvin21914323wi10 - Thanks for the feedback, please mark my previous reply as the correct answer. I would have thought that both versions would have resulted in a valid directory separator being added.

Translate
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