如何使用ExtendScript创建文件夹? [英] How do I create a folder using ExtendScript?

查看:296
本文介绍了如何使用ExtendScript创建文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个似乎就像解决这个问题一样非常容易,但是我已经用了近一个小时的时间来对付它。我只需要一段javascript / extendscript代码,以便我的InDesign CS6脚本可以创建一个文件夹。我知道应该在其中创建新文件夹的现有文件夹,并且我知道应该调用此新文件夹的名称。但是如何让javascript到呢?

This seems like it would be a very easy problem to solve, but I've been banging my head against it for almost an hour. All I need is a snippet of javascript/extendscript code so that my InDesign CS6 script can create a folder. I know the existing folder in which the new one should be created, and I know the name that this new folder should be called. But how do I get javascript to do it?

顺便说一下,所有在线搜索的是folderObj.create()方法,这是在JavaScript工具指南中,证明无用。我已尝试过该方法的几种变体,但似乎没有任何实际创建文件夹。我错过了什么?

By the way, all searches online for the folderObj.create() method, which is in the JavaScript Tools Guide, prove useless. I've tried several variations on that method, but nothing seems to actually create the folder. What am I missing?

推荐答案

好的,找到了解决办法:我必须绝对指定文件夹,而不是使用主页快捷方式。另外,我一开始就使用 / Volumes 。因此,代码变为:

Okay, found a work-around: I have to specify the folder absolutely, rather than use the ~ home shortcut. In addition, I have use /Volumes at the very beginning. Thus, the code becomes:

var f = new Folder("/Volumes/apache HD/Users/apache/Desktop/my_new_fodler");  
f.create();

似乎最终有效。感谢您的帮助,@ Anna Forrest和@fabiantheblind! (你似乎是这里的常驻ExtendScript专家。)

And that seems to work, finally. Thanks for your help, @Anna Forrest and @fabiantheblind! (You seem to be the resident ExtendScript expert around here.)

这篇关于如何使用ExtendScript创建文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆