2014-04-07 3 views
-1

지난 주에이 스크립트의 일부에 대해 질문을하고 올바른 방향으로 나를 보내준 몇 가지 정말 유용한 답을 받았습니다. 나는 스크립트의 끝 부분에 조금 더 추가 할 수 있다는 것을 깨달았습니다. 여기에 제가 가지고있는 것이 있습니다. 이 스크립트는 80 %의 시간 동안 완벽하게 작동합니다. 오류가 발생했을 때 문서 1의 속성을 찾을 수 없다고 말하면서 문서 1에 mydoc 행 세트를 추가하여이 문제를 해결할 수 있다고 생각했습니다. 추가 된 곳은 아직 생각합니다. 때로는 정의되지 않은 변수로 간주됩니다. 이것을 설명하는 더 좋은 방법이 있습니까? 한 가지 다른 문제는 때때로 다운로드 폴더에 2 ~ 3 개의 파일이있을 수 있다는 것입니다. 각 문서마다 반복이 필요합니까? 목표는 일러스트 레이터 문서를 열 때 3 가지 별색을 추가하는 것입니다. 여기 내가 현재오류 : 문서 1의 속성을 찾을 수 없습니다.

tell application "Finder" 
set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name") 
set loc to desktop 
set newfoldername to JobName 
set newfo to make new folder at loc with properties {name:newfoldername} 
make new folder at newfo with properties {name:JobName & "_Seps"} 
make new folder at newfo with properties {name:JobName & "_DTG"} 
set the clipboard to JobName 
end tell 

tell application "Finder" 
open folder JobName 
move (files of alias "Macintosh HD:Users:username:Downloads") to newfo 
end tell 
tell application "Adobe Illustrator" 
open files in newfo 
end tell 

tell application "Adobe Illustrator" 
set mydoc to document 1 
set docColorSpace to color space of document 1 
if (docColorSpace is CMYK) then 
set SpotColor to {cyan:21.0, magenta:0, yellow:100.0, black:0.0} 
else 
set SpotColor to {red:206.0, green:219.0, blue:41.0} 
end if 
make new spot in document 1 with properties {name:"Highlight White", color type:spot color, color:SpotColor} 
end tell 
tell application "Adobe Illustrator" 
set docColorSpace to color space of document 1 
if (docColorSpace is CMYK) then 
set SpotColor to {cyan:11.0, magenta:100, yellow:30.0, black:0.0} 
else 
set SpotColor to {red:215.0, green:23.0, blue:111.0} 
end if 
make new spot in document 1 with properties {name:"Under Base", color type:spot color, color:SpotColor} 
end tell 

tell application "Adobe Illustrator" 
set docColorSpace to color space of document 1 
if (docColorSpace is CMYK) then 
set SpotColor to {cyan:0.0, magenta:0, yellow:0.0, black:100.0} 
else 
set SpotColor to {red:35.0, green:34.0, blue:33.0} 
end if 
make new spot in document 1 with properties {name:"Spot Black", color type:spot color, color:SpotColor} 
end tell 
+0

제목은 질문을 설명해야합니다. –

+0

코드를 다시 포맷 해 주시겠습니까? 그것은 거의 읽을 수 없습니다. – Mark

+0

절름발이의 제목과 형식에 대해 유감스럽게 생각합니다. 처음으로 형식을 올바르게 지정하지 않았지만 직장에서 나에게 전자 메일로 보내고 전화에서 게시했습니다. – jamthelows

답변

2

귀하의 코드는 문제를 많이 그래서 난 당신을 위해 그것을 다시 썼다가있는 것입니다. Illustrator 코드가 없기 때문에 Illustrator 코드를 확인하지 않았습니다. 작동하지 않으면 조정할 필요가 있습니다.

코드의 주요 문제점은 newfo입니다. 해당 폴더를 만들 때 Finder가 생성하는 경로는 Finder에서만 이해할 수있는 형식입니다. Illustrator에서는 해당 형식을 인식하지 못합니다. 이것은 경험으로 알 수있는 것입니다. 파인더 경로는 다음과 같이 설명됩니다.

file something of folder something of folder something of disk something 

해당 스타일은 Finder에서 고유합니다. 따라서 경로가 Finder 외부에서 유용 할 필요가 있다면 우리는 그 스타일을 다른 프로그램이 이해할 수있는 것으로 변경해야합니다. 아래 코드에서 Finder에서 newfo의 모든 파일을 가져올 수 있지만 Illustrator에서 "별칭 목록"으로 알 수있는 내용으로 변환합니다. 모든 프로그램에서 이해할 수있는 별칭 참조에서 모든 Finder 참조를 변환합니다.

잘하면이 코드가 도움이 될 것입니다. 연습을 계속하면 그것이 나아질 수있는 유일한 방법입니다. 행운을 빕니다.

-- get JobName 
set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name") 

-- setup folder paths 
set loc to path to desktop as text 
set downloadsFolder to path to downloads folder as text 
set newfo to loc & JobName & ":" 
set newfoSeps to newfo & JobName & "_Seps" & ":" 
set newfoDTG to newfo & JobName & "_DTG" & ":" 

-- make sure all of the folders exist 
tell application "Finder" 
    if not (exists folder newfo) then 
     make new folder at loc with properties {name:JobName} 
    end if 

    if not (exists folder newfoSeps) then 
     make new folder at folder newfo with properties {name:JobName & "_Seps"} 
    end if 

    if not (exists folder newfoDTG) then 
     make new folder at folder newfo with properties {name:JobName & "_DTG"} 
    end if 
end tell 

set the clipboard to JobName -- this is not a Finder command so we do not put it in the Finder block of code 

-- move files to newfo and get a list of them 
tell application "Finder" 
    open folder newfo 
    move (files of folder downloadsFolder) to folder newfo 
    set newfoFiles to (files of folder newfo) as alias list 
end tell 

-- open each file in Illustrator and do your stuff 
repeat with aFile in newfoFiles 
    tell application "Adobe Illustrator" 
     open aFile 
     tell document 1 
      set docColorSpace to color space 
      if (docColorSpace is CMYK) then 
       set SpotColor1 to {cyan:21.0, magenta:0, yellow:100.0, black:0.0} 
       set SpotColor2 to {cyan:11.0, magenta:100, yellow:30.0, black:0.0} 
       set SpotColor3 to {cyan:0.0, magenta:0, yellow:0.0, black:100.0} 
      else 
       set SpotColor1 to {red:206.0, green:219.0, blue:41.0} 
       set SpotColor2 to {red:215.0, green:23.0, blue:111.0} 
       set SpotColor3 to {red:35.0, green:34.0, blue:33.0} 
      end if 

      make new spot with properties {name:"Highlight White", color type:spot color, color:SpotColor1} 
      make new spot with properties {name:"Under Base", color type:spot color, color:SpotColor2} 
      make new spot with properties {name:"Spot Black", color type:spot color, color:SpotColor3} 
     end tell 
    end tell 
end repeat 
+0

스크립트가 잘 작동합니다! 첫 번째 절에서 일했지만 Illustrator에 명령을 추가 할 때 문제가 발생하면 설명이 도움이됩니다. 정말 다운로드 폴더 비트와 함께 고민하고 정말 스크립트가 ("Macintosh HD : 사용자 : Yourusernamehere : Downloads"라는 별칭의 파일)에 대한 필요성을 제거하는 방법을 좋아합니다. Illustrator 섹션은 Adobe 매뉴얼에서 바로 제공되므로 매번 작동하지 않는 이유를 이해하지 못했습니다. – jamthelows

+0

어느 시점에서 전체 프로세스 (크롬, 파일 메이커, 파인더 및 일러스트 레이터 사이)를 완전히 자동화하려고 시도하지만, 자바로 이것을 시도하는 것이 가장 좋습니다. 나는 배울 것이 많지만 도움을 주셔서 감사합니다! 귀하의 사용자 이름 뒤에 스크립트 이름을 지정했습니다. – jamthelows

+0

폴더의 파일 뭔가 폴더 뭔가 디스크의 뭔가 뭔가 내가 이전에 발견했으면 좋겠어 -이 어딘가에 더 noobs에 대한 표시되어야합니다. – jamthelows

관련 문제