Skip to main content
Inspiring
December 16, 2022
Answered

「Power Automate Desktop」でのInDesign操作は禁止されていませんか?

  • December 16, 2022
  • 3 replies
  • 1379 views

「Power Automate Desktop」および「Power Automate Desktop」内の「スクリプトの実行」を使ってInDesignを操作しよう思ったのですが

「How to control Adobe InDesign from PowerShell」で調べると「your license of inDesign forbids you to do this on a server unattended」の記述がありました。

 

個人もしくは会社のPCで「Power Automate Desktop」でInDesignを自動化するのは問題ないのでしょうか?

This topic has been closed for replies.
Correct answer Omachi

突き詰めるとライセンス条項の解釈ということになるので、正確なところはサポートに問い合わせることになります。

ただ以前、私が法務部(今もその名称かは知らない)と話をしたときは、間接的にInDesignを操作する場合は、動作をキックする人(問い合わせ時はデータ入力者)が有効なライセンスを所持していれば問題ないということでしたので、自宅のパソコンということであればおおむね問題はないかと思います。

会社の場合はネットワーク経由であったり、ライセンスを有していない人が操作する可能性があるのであれば、それは問題があると思います。

3 replies

Inspiring
December 20, 2022

Power Automate DesktopでExcelのデータからInDesignの索引を作るフローを作成してみました。
実行は自己責任でお願いします(途中で自動でのキー操作が有るので)

 

以下のテキスト(Robin)を

/# ExcelのデータからInDesignの索引を作成
更新:2022/12/21#/
Display.ShowMessageDialog.ShowMessage Message: $'''ExcelのデータからInDesignの索引を作成します。
索引を作成したいInDesignのドキュメントを開いた状態にして下さい。

Excelの例(索引文字 読み)
猫    ねこ
犬    いぬ
ペンギン
熊    くま
''' Icon: Display.Icon.Question Buttons: Display.Buttons.YesNo DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed
IF ButtonPressed = $'''No''' THEN
    EXIT Code: 0
END
IF (UIAutomation.IfWindow.IsNotOpenByTitleClass Title: $'''''' Class: $'''indesign''') THEN
    Display.ShowMessageDialog.ShowMessage Message: $'''InDesignが開いていないようです。''' Icon: Display.Icon.Information Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    EXIT Code: 0
END
Scripting.RunVBScript VBScriptCode: $'''Dim app : Set app = CreateObject(\"InDesign.Application\") \'Target the last version of InDesign that was launched with admin privileges
Dim MyDocumentCountNumber : MyDocumentCountNumber = app.documents.count()
WScript.StdOut.Write(MyDocumentCountNumber) \'Output
Set app = Nothing \'Release reference''' ScriptOutput=> VBScriptOutput
IF VBScriptOutput = 0 THEN
    Display.ShowMessageDialog.ShowMessage Message: $'''InDesignのドキュメントが開かれていないようです。''' Icon: Display.Icon.Information Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True
    EXIT Code: 0
END
Display.SelectFileDialog.SelectFile Title: $'''Select Excel file''' IsTopMost: True CheckIfFileExists: False SelectedFile=> SelectedFile ButtonPressed=> ButtonPressed
IF ButtonPressed = $'''Cancel''' THEN
    EXIT Code: 0
END
Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: SelectedFile Visible: False ReadOnly: False Instance=> ExcelInstance
Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance ReadAsText: True FirstLineIsHeader: False RangeValue=> ExcelData
Excel.CloseExcel.Close Instance: ExcelInstance
UIAutomation.SetWindowState.SetStateByTitleClass Title: $'''''' Class: $'''indesign''' State: UIAutomation.WindowState.Minimized
/# 「検索と置換」の検索条件の初期化
#/
Scripting.RunVBScript VBScriptCode: $'''Dim app : Set app = CreateObject(\"InDesign.Application\") \'Target the last version of InDesign that was launched with admin privileges
app.findTextPreferences = 1851876449 \'NothingEnum.NOTHING
Set app = Nothing \'Release reference'''
IF (UIAutomation.IfWindow.IsNotOpenByTitleClass Title: $'''Windows PowerShell''' Class: $'''''') THEN
    System.RunApplication.RunApplicationAndWaitToLoad ApplicationPath: $'''powershell.exe''' WindowStyle: System.ProcessWindowStyle.Maximized Timeout: 0
END
# 最小化されていたウィンドウに入力すると上手くいかない時がある
MouseAndKeyboard.SendKeys.FocusAndSendKeysByTitleClass Title: $'''Windows PowerShell''' Class: $'''''' TextToSend: $'''$app = New-Object -ComObject InDesign.Application{Return}''' DelayBetweenKeystrokes: 0 SendTextAsHardwareKeys: False
LOOP FOREACH CurrentItem IN ExcelData
    # 索引文字を検索
    MouseAndKeyboard.SendKeys.FocusAndSendKeysByTitleClass Title: $'''Windows PowerShell''' Class: $'''''' TextToSend: $'''# Find text %CurrentItem[0]%{Return}''' DelayBetweenKeystrokes: 0 SendTextAsHardwareKeys: False
    Scripting.RunPowershellScript Script: $'''&{
    $app = New-Object -ComObject InDesign.Application #Target the last version of InDesign that was launched with admin privileges
    $MyScriptLanguage = 1246973031 # ScriptLanguage.JAVASCRIPT
    $MyArgumentsArray = @(\"%CurrentItem[0]%\") # Create array
    $MySource = ` # Line breaks in expressions
@\"
app.findTextPreferences.findWhat = arguments[0];
var mySearchResultArray = app.activeDocument.findText();
if(mySearchResultArray.length > 0){
	app.activeDocument.select(mySearchResultArray[0]);
}
mySearchResultArray.length
\"@
    Write-Output $app.doScript($MySource, $MyScriptLanguage, $MyArgumentsArray) # Run ExtendScript & get output to variable
}
[gc]::Collect() # GC''' ScriptOutput=> PowershellOutput
    # 索引文字が見つかった場合
    IF PowershellOutput >= 1 THEN
        MouseAndKeyboard.SendKeys.FocusAndSendKeysByTitleClass Title: $'''Windows PowerShell''' Class: $'''''' TextToSend: $'''$app.menuActions.itemByID(78082).invoke(){Return}''' DelayBetweenKeystrokes: 0 SendTextAsHardwareKeys: False
        IF CurrentItem.ColumnsCount > 1 THEN
            # 読み有り
            MouseAndKeyboard.SendKeys.FocusAndSendKeysByTitleClass Title: $'''新規ページ参照''' Class: $'''''' TextToSend: $'''{Alt}({S})%CurrentItem[1]%{Alt}({L}){Return}''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
        ELSE
            # 読み無し
            MouseAndKeyboard.SendKeys.FocusAndSendKeysByTitleClass Title: $'''新規ページ参照''' Class: $'''''' TextToSend: $'''{Alt}({L}){Return}''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
        END
    END
END
MouseAndKeyboard.SendKeys.FocusAndSendKeysByTitleClass Title: $'''Windows PowerShell''' Class: $'''''' TextToSend: $'''[gc]::Collect(){Return}''' DelayBetweenKeystrokes: 0 SendTextAsHardwareKeys: False
UIAutomation.FocusWindow.FocusByTitleClass Title: $'''''' Class: $'''indesign'''
Display.ShowMessageDialog.ShowMessage Message: $'''フローが終了しました。''' Icon: Display.Icon.Information Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True

 

 

 

Power Automate Desktopの次の画面に張り付けて使って下さい。

Inspiring
December 20, 2022

ダイアログが表示されるとScriptが止まってしまう壁が破れた気がします。

実行動画

https://www.youtube.com/watch?v=aYVaGJkQFgQ 

 

フローの中でPowerShellでのInDesignのCOM操作をおこなったのですが不慣れで苦労しました。

日本語で質問できるSupport Communityの存在の有難さをしみじみと感じました。

Inspiring
July 21, 2023

Power Automate Desktop(PAD)のフローのサンプルをありがとうございます。

初歩的な質問ですみませんが、フローの中で、VBscript と PowerShellでのJavaScript を使っていますが、なぜこのようなことをしているのでしょうか?
VBscript ではできないことを PowerShellでのJavaScript で実現しているという解釈でよろしいですか?

Omachi
OmachiCorrect answer
Legend
December 16, 2022

突き詰めるとライセンス条項の解釈ということになるので、正確なところはサポートに問い合わせることになります。

ただ以前、私が法務部(今もその名称かは知らない)と話をしたときは、間接的にInDesignを操作する場合は、動作をキックする人(問い合わせ時はデータ入力者)が有効なライセンスを所持していれば問題ないということでしたので、自宅のパソコンということであればおおむね問題はないかと思います。

会社の場合はネットワーク経由であったり、ライセンスを有していない人が操作する可能性があるのであれば、それは問題があると思います。

Inspiring
December 17, 2022

Omachiさん

 

Omachiさんの公開されている「Excelを利用したVBScriptの作り方」等も大変参考になりました、有難うございます。

Ten A
Community Expert
Community Expert
December 16, 2022

CCアプリケーションのオートメーションは完全な自動化はライセンス的に禁止されています。基本的に人間が操作して自動処理を実行する必要があります。

完全な自動化を考えるのであればInDesign Serverが必要です。