実現したいこと
特定のフォルダの中にあるInDファイルを書き出したいのですがうまくいきません。
手動でリンクを更新ではなく自動でリンクを更新したいのですが現状だとリンクが更新されないで書き出されてしまいます。
リンク元はインデと同じ階層のフォルダの中にあります。
どなたかご教示いただけないでしょうか。
発生している問題・分からないこと
リンク更新されない。
該当のソースコード
-- 選択しているフォルダを取得 tell application "Finder" set targetFolder to item 1 of (selection as alias list) set targetPath to POSIX path of targetFolder set linksFolderPath to targetPath & "Links/" -- Linksフォルダのパスを設定 set indesignFiles to (files of targetFolder whose name extension is "indd") as alias list end tell -- InDesignファイルのPDF書き出し tell application "Adobe InDesign 2022" set pdfPreset to "[高品質印刷]" -- 必要に応じてプリセットを変更 set user interaction level of script preferences to never interact -- ダイアログを無効化 repeat with indFile in indesignFiles set filePath to POSIX path of indFile set fileName to name of (info for indFile) set outputPDFPath to targetPath & (text 1 thru -6 of fileName) & ".pdf" try -- ファイルを開いてリンクを更新し、PDF書き出し set doc to open filePath without showing window -- リンクを個別に更新 set allLinks to links of doc repeat with aLink in allLinks try if link status of aLink is not normal then -- Linksフォルダ内の対応するファイルを検索 set linkFileName to name of aLink set linkFilePath to linksFolderPath & linkFileName -- リンクファイルが存在する場合に再指定 if (do shell script "test -e " & quoted form of linkFilePath & "; echo $?") = "0" then relink aLink to linkFilePath else display dialog "リンクが見つかりません: " & linkFileName buttons {"OK"} default button "OK" end if end if end try end repeat -- PDF書き出し export doc format PDF type to outputPDFPath using pdf export preset pdfPreset close doc saving no end try end repeat set user interaction level of script preferences to interact with all -- ダイアログを元に戻す end tell -- 完了メッセージ (省略可能) display dialog "すべてのPDF書き出しが完了しました。" buttons {"OK"} default button "OK"
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
chatGPTで何度もやってもダメでした...
補足
特になし
回答1件
あなたの回答
tips
プレビュー