美好的一天,
我使用了多个来源来创建用于创建文件夹结构的工作流程,从而创建子文件夹。我遇到的问题是在' MyCompany"下创建子文件夹的部分。子目录。
tell application "Finder"
set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name")
set Customer to text returned of (display dialog "Customer Name:" default answer "Customer")
set loc to choose folder "Choose Parent Folder Location"
set incomingDate to (current date)
set yr to year of incomingDate as text
set mo to (month of incomingDate as number) as text
if ((length of mo) = 1) then
set mo to "0" & mo
end if
set dy to day of incomingDate as text
if ((length of dy) = 1) then
set dy to "0" & dy
end if
set newfoldername to mo & dy & yr & "-" & JobName
set customer2 to Customer & "-" & JobName
set newfo to make new folder at loc with properties {name:newfoldername}
make new folder at newfo with properties {name:"Caps"}
set doc to make new folder at newfo with properties {name:"Document"}
make new folder at doc with properties {name:"Customer"}
make new folder at doc with properties {name:"Lic"}
make new folder at doc with properties {name:"Deliverable"}
make new folder at doc with properties {name:"Mfg"}
make new folder at doc with properties {name:"Validation"}
set mdc to make new folder at newfo with properties {name:"MyCompany"}
make new folder at mdc with properties {name:"Quotes"}
make new folder at mdc with properties {name:"SoW"}
make new folder at mdc with properties {name:"Private"}
set cfg to make new folder at newfo with properties {name:"Config"}
make new folder at cfg with properties {name:"Sites"}
make new folder at cfg with properties {name:"Worksheet"}
make new folder at cfg with properties {name:"Backups"}
make new folder at cfg with properties {name:"Logs"}
set diag to make new folder at newfo with properties {name:"Diagrams"}
make new folder at diag with properties {name:"Screenshots"}
make new folder at diag with properties {name:"Visio"}
make new folder at diag with properties {name:"Logos"}
make new folder at newfo with properties {name:"Scripts"}
end tell
tell application id "com.evernote.Evernote"
create note with text "via Apple WorkFlow" title customer2 notebook "Inbox"
end tell
我想要的是:
mmddyy-%CURRENTTIME%-JobName 文献 我的公司 行情 母猪 私人
非常感谢任何帮助。
答案 0 :(得分:0)
不确定这是否是最干净的方式,但它对我有用:
-- Sets up the JobName, CustomerName and location by asking the user
set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name")
set Customer to text returned of (display dialog "Customer Name:" default answer "Customer")
set loc to choose folder "Choose Parent Folder Location"
- 设置日期变量
set incomingDate to (current date)
set yr to year of incomingDate as text
set mo to (month of incomingDate as number) as text
if ((length of mo) = 1) then
set mo to "0" & mo
end if
set dy to day of incomingDate as text
if ((length of dy) = 1) then
set dy to "0" & dy
end if
- 设置要与日期一起使用的文件名
set newfoldername to mo & dy & yr & "-" & JobName
set customer2 to Customer & "-" & JobName
tell application "Finder"
--Parent Directory Structure
set dir_1 to make new folder at loc with properties {name:newfoldername}
set dir_2 to make new folder at dir_1 with properties {name:"Caps"}
set dir_3 to make new folder at dir_1 with properties {name:"Configs"}
set dir_4 to make new folder at dir_1 with properties {name:"Diagrams"}
set dir_5 to make new folder at dir_1 with properties {name:"Documents"}
set dir_6 to make new folder at dir_1 with properties {name:"Scripts"}
-- Sub-Folder structure
set sub_3_1 to make new folder at dir_3 with properties {name:"Backups"}
set sub_3_2 to make new folder at dir_3 with properties {name:"Logs"}
set sub_3_3 to make new folder at dir_3 with properties {name:"Sites"}
set sub_3_4 to make new folder at dir_3 with properties {name:"Worksheets"}
set sub_4_1 to make new folder at dir_4 with properties {name:"Logos"}
set sub_4_2 to make new folder at dir_4 with properties {name:"Screenshots"}
set sub_4_3 to make new folder at dir_4 with properties {name:"Network Diagrams"}
set sub_5_1 to make new folder at dir_5 with properties {name:"Customer"}
set sub_5_2 to make new folder at dir_5 with properties {name:"Deliverable"}
set sub_5_3 to make new folder at dir_5 with properties {name:"License"}
set sub_5_4 to make new folder at dir_5 with properties {name:"Certificates"}
set sub_5_5 to make new folder at dir_5 with properties {name:"MyCompany"}
set sub_5_6 to make new folder at dir_5 with properties {name:"Validation"}
-- Creates sub-folders under \MyCompany
set sub2_5_1 to make new folder at sub_5_5 with properties {name:"BoMs"}
set sub2_5_2 to make new folder at sub_5_5 with properties {name:"Quotes"}
set sub2_5_3 to make new folder at sub_5_5 with properties {name:"Private"}
set sub2_5_4 to make new folder at sub_5_5 with properties {name:"SoW"}
-- Set variable to be used by Evernote
set custfldr to the loc as text
end tell
tell application "Finder"
set the clipboard to the loc as text
end tell
tell application id "com.evernote.Evernote"
create note with text custfldr title customer2 notebook "Inbox"
end tell
这给了我理想的结果。