This content has been machine translated dynamically.
Dieser Inhalt ist eine maschinelle Übersetzung, die dynamisch erstellt wurde. (Haftungsausschluss)
Cet article a été traduit automatiquement de manière dynamique. (Clause de non responsabilité)
Este artículo lo ha traducido una máquina de forma dinámica. (Aviso legal)
此内容已动态机器翻译。 放弃
このコンテンツは動的に機械翻訳されています。免責事項
This content has been machine translated dynamically.
This content has been machine translated dynamically.
This content has been machine translated dynamically.
This article has been machine translated.
Dieser Artikel wurde maschinell übersetzt. (Haftungsausschluss)
Ce article a été traduit automatiquement. (Clause de non responsabilité)
Este artículo ha sido traducido automáticamente. (Aviso legal)
この記事は機械翻訳されています.免責事項
이 기사는 기계 번역되었습니다.
Este artigo foi traduzido automaticamente.
这篇文章已经过机器翻译.放弃
Translation failed!
Forward Pathの例
この例では、単純なForward Pathシナリオとタスクスクリプトの作成手順について説明します。
シナリオの作成
-
AppDNAメニューから、「構成」>「Forward Path」を選択します。
-
Forward Path Logic エディタのツールバーで、[新しいシナリオ] をクリックします。
-
[Forward Pathスクリプト名] ダイアログボックスで、新しいシナリオの名前と説明を入力し、[OK] をクリックします。
これにより、新しいシナリオが作成され、エディタで開きます。新しいシナリオスクリプトは次のとおりです。
1 Public Function ForwardPath(ByVal currentApplication As Application) As Output 2 ' TODO: Your new Forward Path Logic definition must be defined here. 3 ' Refer to the sample Forward Path scripts which have been provided. 4 Dim myForwardpathresult As New Output() 5 6 myForwardpathresult.Outcome = "Sample Outcome" 7 myForwardpathresult.Cost = 100 8 myForwardpathresult.RAG = RAG.Green 9 10 ForwardPath = myForwardpathresult 11 12 End Function
-
これは機能的なシナリオスクリプトですが、実用的ではありません。どのように動作するかを理解するには、[エディタ] ツールバーの [テスト] をクリックします。
これにより、[アプリケーションリスト] で現在選択されているアプリケーションに対してシナリオが評価され、[出力] タブに結果が表示されます。
[結果] 列の値は、各アプリケーションの [サンプル結果] であり、同様に、選択したすべてのアプリケーションの [RAG列] および [コスト] 列の値が [緑] および [100] であることに注意してください。これは、これらの列の値が 6 行目でスクリプトで「ハードコード」されているためです。
シナリオではこれらの列の値が提供されないため、[説明] 列と [カスタムフィールド] 列は空です。
-
Windows 7レポートのアプリケーションの実際のRAGを反映するように、RAG列の値を変更します。シナリオスクリプトの行 8 を次のように変更します。
myForwardpathresult.RAG = currentApplication.Modules.Windows7.RAG
これにより、RAG列の値がアプリケーションのWindows 7のRAGステータスに設定されます。(これは、アプリケーションが既にWindows 7レポート用に分析されていることを前提としています。このレポートが利用できない場合は、利用可能な別のレポートを選択します。プロパティエクスプローラを使用して、他のレポートを参照する方法を確認します)。
-
[テスト] をクリックして結果を確認します。
RAG列の値は、実際のRAG値を反映しています。
-
次に、[結果] 列の値がWindows 7のRAGステータスに依存するようにします。これを行うには、次のように 6 行目を If ステートメントに置き換えます。
If (currentApplication.Modules.Windows7.RAG = RAG.Green) Then myForwardpathresult.Outcome = "OK for Windows 7" Else If (currentApplication.Modules.Windows7.RAG = RAG.Amber) Then myForwardpathresult.Outcome = "Remediation required" Else myForwardpathresult.Outcome = "Redevelopment required" End If End If
このステートメントは、アプリケーションの Windows 7 の RAG ステータスが緑であるかどうかをテストします。その場合、スクリプトは [結果] 列に「OK for Windows 7」と書き込み、そうでない場合は、Windows 7 RAGステータスが黄色であるかどうかをテストします。黄色の場合、スクリプトは「Remediation required」を「Outcome」列に書き込み、それ以外の場合は「Reevelopment required」を「Outcome」列に書き込みます。これは、RAGステータスが緑色またはオレンジ色でない場合は、(アプリケーションが分析され、ロック解除されていると仮定して)赤色である必要があるためです。
-
[テスト] をクリックして結果を確認します。
これで、Outcome 列の値が If ステートメントのロジックを反映していることに注意してください。
これは、Forward Path の動作を紹介するために意図的に些細な例です。より現実的な例を表示するには、シナリオエクスプローラを使用してAppDNAに付属のサンプルシナリオを参照し、プロパティエクスプローラを使用してシナリオスクリプトで使用できるプロパティを確認します。
メモ: Output オブジェクトは,プロパティエクスプローラで ForwardPathReportOutput として表示されます。
たとえば、Output.Display プロパティを使用すると、次のようにレポートの標準列の幅と表示を制御できます。
myForwardpathresult.Display.Application.Width = 250
myForwardpathresult.Display.Manufacturer.Width = 100
myForwardpathresult.Display.Version.Width = 50
myForwardpathresult.Display.SourcePath.Visible = false
myForwardpathresult.Display.Outcome.Width = 400
同様に、Output.CustomFieldn.Display プロパティを使用して、カスタムフィールドの列の幅と可視性を制御できます。
myForwardpathresult.CustomField1.Display.Width = 50
myForwardpathresult.CustomField2.Display.Width = 100
これらのプロパティは、レポート実行時の列の表示を制御します。これらは、Forward Path ロジックエディタの [出力] タブの列を制御しません。
タスクスクリプトを作成する
ここでは、シナリオスクリプトの例で作成した「結果」列の「再開発が必要」値に関連付けられたタスクスクリプトを作成します。
-
前のステップで作成したサンプルスクリプトをエディタで開きます。
-
メインツールバーで、[新しいタスクスクリプト] をクリックします。
これにより、[Forward Pathタスクスクリプト] ダイアログボックスが開きます。このダイアログボックスには、エディタで開いているシナリオの [結果] 列に可能な値が一覧表示されます。
-
ドロップダウンリストから、[再開発が必要] を選択し、説明を入力して [OK] をクリックします。
これにより、新しいタスクスクリプトが作成され、エディタで開きます。新しいタスクスクリプトは次のとおりです。
1 ' This sample script kicks off an Install Capture of the given file 2 ' as well as interacts with the gui 3 LoadAssembly System.Windows.Forms.dll 4 5 Imports AppDNA.AppTitude.Scripting 6 Imports System.Collections.Generic 7 8 Public Class ScriptClass 9 10 Public Function Start(controller As IActionController) As TaskStatusEnum 11 ' If you need to override or provide replaceable to the 12 ' execution profiles add then to this dictionary 13 14 Dim replaceables As Dictionary(Of String, String) 15 ' replaceables.Add( "replaceablename", "value") 16 17 ' This informs the controller that it can abort if the user cancels 18 controller.AbortOnCancel() 19 20 ' This lets you run the execution profile for a given app using a given VM 21 ProductionManager.RunExecutionProfile(controller, "Snapshot", replaceables, "Default VM Configuration") 22 23 ' Add you own actions 24 controller.GUI.ProgressPercent = 100 25 Start = TaskStatusEnum.Complete 26 End Function 27 28 End Class
これは、Install Captureを開始するスケルトンタスクスクリプトです。
-
私たちは、電子メールを送信するコードを使用して、Install Captureに関連する行(11行目-21行)を変更します。ただし、まず、6行目の後に次の行を追加して、電子メールを送信する必要がある名前空間をインポートします。
Imports System.Net.Mail Imports System.Net
-
次に、Install Captureコード (現在 13 ~ 23 行) を次のように置き換えます。
' This informs the controller that it can abort if the user cancels controller.AbortOnCancel() Dim myClient As New SmtpClient("<validsmtpserver>") myClient.Credentials = New NetworkCredential("<emailaccountusername>", "<emailaccountpassword>") Dim MainMessage As String = "" Dim Message As New MailMessage() Dim Address As New MailAddress("<fromaddress>", "AppDNA Notification") Dim ToAddress As New MailAddress("<recipientemailaddress>") MainMessage = MainMessage + "<html>" MainMessage = MainMessage + "<head>" MainMessage = MainMessage + "<title>AppDNA Notification</title>" MainMessage = MainMessage + "</head>" MainMessage = MainMessage + "<body>" MainMessage = MainMessage + "Hello," MainMessage = MainMessage + "<br />" MainMessage = MainMessage + "<br />" MainMessage = MainMessage + "Application needs redevelopment." MainMessage = MainMessage + "<br />" MainMessage = MainMessage + "Application Name: " + controller.Application.Name MainMessage = MainMessage + "<br />" MainMessage = MainMessage + "Source Path: " + controller.Application.SourcePath MainMessage = MainMessage + "<br />" MainMessage = MainMessage + "Goodbye." MainMessage = MainMessage + "<br />" MainMessage = MainMessage + "</body>" MainMessage = MainMessage + "</html>" Message.Body = MainMessage Message.IsBodyHtml = True Message.From = Address Message.To.Add(ToAddress) Message.Subject = "AppDNA Notification" myClient.Send(Message)
-
<validsmtpserver>、<emailaccountusername>、<emailaccountpassword>、<fromaddress>、<recipientemailaddress> を環境に適した値に置き換えます。
-
[保存] をクリックして変更を保存します。
-
次に、タスクスクリプトを実行してみましょう。
- AppDNAサイドバーで、「レポート」>「アプリケーション」>「Forward Path」の順に選択します。
- Forward Path レポートビューアで、先ほど作成した Forward Path シナリオを選択します。
- [タスクの評価] をクリックします。
[Forward Path Task Sequencing] 画面が開きます。この画面には、Forward Pathシナリオで処理されたアプリケーションが一覧表示され、タスク・スクリプトが関連付けられているかどうかが表示されます。
-
タスク・スクリプトが関連付けられているアプリケーションを選択し、ツールバーの「開始」をクリックします。
これにより、そのアプリケーションのタスクスクリプトが実行されます。[Status] 列には、スクリプトが正常に実行されたかどうかが表示されます。エラーが発生すると、画面の下部に表示されます。この例では、環境に適したメールパラメータを入力していない場合 (上記の手順 6)、スクリプトは失敗します。
- さらにいくつかの例を表示するには、タスクスクリプトエクスプローラを使用して、AppDNAに付属のサンプルタスクスクリプトを参照します。
- タスクスクリプトから実行プロファイルを実行する方法については、「実行プロファイルの実行」を参照してください。
共有
共有
この記事の概要
This Preview product documentation is Citrix Confidential.
You agree to hold this documentation confidential pursuant to the terms of your Citrix Beta/Tech Preview Agreement.
The development, release and timing of any features or functionality described in the Preview documentation remains at our sole discretion and are subject to change without notice or consultation.
The documentation is for informational purposes only and is not a commitment, promise or legal obligation to deliver any material, code or functionality and should not be relied upon in making Citrix product purchase decisions.
If you do not agree, select Do Not Agree to exit.