保存時に元のファイル名を使用する場合は、ファイルのプロパティから取得して、保存先のパスと組み合わせることができます。次のようにします。
set origName to the name of document 1 as string
save document 1 to ("your:path:here:" & origName)
origName
編集:サフィックスを置き換えるための独自のルーチンが既にある場合は、save コマンドに渡す前にそれらの操作を実行できます。誰にとっても役立つ場合に備えて、接尾辞の置換については以下に示しておきます。
質問の 2 番目の部分である接尾辞の置き換えについては、正確に何をしたいかによって異なります。あなたの例から、次のコードで行うことができる数値を増やしたいと思います。
set thePoint to the offset of "." in origName
set firstPart to (characters 1 through (thePoint - 1) of origName) as string
set fpLength to the length of firstPart
set newSuffix to ((the last character of firstPart) as number) + 1
set newName to (characters 1 through (fpLength - 1) of firstPart) & newSuffix ¬
& ".indd" as string
これは、ファイルの名前をその拡張子から分離し、その名前の最後の文字 (数字に変換) を 1 ずつインクリメントして新しい接尾辞を作成し、そのロットを組み合わせて完全なファイル名を形成し、保存で使用できるようにします。指図。
重要なのは、元のファイル名を分解してから、パーツに対して操作を実行することです。
現在、これにはいくつかの制限があります。1 桁以外の接尾辞を使用すると、事態が複雑になります (不可能ではありません)。また、スクリプトを実行するすべてのユーザーが、Finder の設定で「すべてのファイル拡張子を表示」を有効にしていると想定します (これは機能します)。ただし、周り)。
すべてをまとめると、次のようになります。
tell application "Adobe InDesign CS5.5"
set origName to the name of document 1 as string
set thePoint to the offset of "." in origName
set firstPart to (characters 1 through (thePoint - 1) of origName) as string
set fpLength to the length of firstPart
set newSuffix to ((the last character of firstPart) as number) + 1
set newName to (characters 1 through (fpLength - 1) of firstPart) ¬
& newSuffix & ".indd" as string
save document 1 to ("your:path:here:" & newName)
end tell
使用するサフィックスについてさらに情報を提供していただければ、喜んで回答を更新します。