画像ファイルとスイート情報
このセクションの関数は、画像ファイルとEggplant Functionalスイートに関連付けられたさまざまなプロパティを返します。
ImageInfo 関数
挙動: 単一の画像に対する画像プロパティリスト、または複数の画像リファレンスに対する画像プロパティリストを返します。利用可能なデータによって、リストには次のプロパティが含 まれることがあります:
- CaptureDate: 画像のキャプチャ日時、時間を含むフォーマット (yyyy-mm-dd hh:mm:ss +0000) で示されます。最後の4桁はGMTのオフセットを表します。
- CaptureHost: 画像がキャプチャされたSUTの名前。
- CaptureLocation: Viewerウィンドウで画像がキャプチャされた時の、画像の左上隅の位置を示す座標。
- CaptureScreenSize: 画像がキャプチャされたSUTの画面の寸法を、ピクセル単位 (
width,height) で表します。 - Description: Suite Editor Infoパネルの画像説明。
- HotSpot: 画像のホットスポットの座標を、(x, y) で示します。
- ImageLocation: 画像のホットスポットの画面上の座標。ImageLocation() 関数を参照してください。
- ImageName: 画像ファイルの名前。
- ImagePath: 画像ファイルのフルパス名。
- ImageRectangle: ImageRectangle() 関数を使用して見つけた画像の矩形座標。
- ImageSize: 画像のピクセル単位のサイズを、(
width,height) で示します。 - ImageTolerance: SUTで画像をキャプチャする際に使用された許容設定。
- Pulsing: 画像がパルシング設定でキャプチャされたかどうか (true/false)。
- Scale: 画像をキャプチャするために使用したスケール。
- SearchType: 画像を保存する際に選択された検索タイプ。
パラメータ ー: 1つ以上の Image References。 戻り値: 画像プロパティリスト、または画像プロパティリストのリスト。例えば:
((CaptureDate:"2016-10-19 15:20:52 -0600", CaptureHost:"Windows", CaptureLocation:(527,707), CaptureScreenSize:(1024,768), Description:"", HotSpot:(11,19), ImageLocation:"", ImageName:"Value", ImagePath:"C:/Users/Carrie/Documents/Demo.suite/Images/ValueField.png", ImageRectangle:"", ImageSize:(23,39), Pulsing:"False", Scale:"1", SearchType:"Tolerant"))
例:
put ImageInfo("BrowserIcon") into ListVariable //画像情報関数の戻り値を変数に格納します。
例:
put the number of items of imageInfo("CheckBox") into NumberinReturn //ImageInfoの戻り値のアイテム数を格納します。
if NumberinReturn is greater than 1 then log "There are" && NumberinReturn && "images in the collection." //戻り値のアイテム数が1より大きいかどうかをチェックし、その場合は画像が実際に画像コレクションであることを意味します。
例:
copy file imageInfo("CompanyLogo")'s imagePath to folder "C:\Users\Carrie\Desktop\ResultsFolder" //現在のスイート内の画像をeggPlantマシンの新しい場所にコピーします。
例:
put the suiteinfo's imagesfolder into myimagefolder //現在のスイートに画像フォルダへのパスを保存します。
put the files of myimagefolder as a list into myimages //画像フォルダ内のすべてのファイル名(imageinfoファイルを含む)をリストとして格納します。
repeat with each item of myimages by reference //メモリ内ではなく、参照によりリストを繰り返します。
if it contains "imageinfo" then delete it //それがimageinfoファイルならば、 リストからファイル名を削除します。
end repeat
repeat with each item of myimages //imageinfoファイル名が削除された後のファイル名リストを繰り返します。
put imageinfo(it)'s CaptureDate into mycapturedate //CaptureDateプロパティ値を変数に格納します。
If mycapturedate is not empty and mycapturedate is earlier than 1 year ago then //CaptureDateが1年以上前に行われたかどうかを判断します。
do merge of <<Logwarning "Image [[it]] was captured over a year ago.">>//merge関数を使用して文字列を構成し、メッセージをログに記録します。
end if
end repeat
ImageHotSpot機能
**行動:**イメージのホット スポットの座標 (x,y) を、イメージの左上隅を基準にして返します。
SUTで見つかった画像のホットスポット位置を操作する必要がある場合は、ImageLocation()関数を使用します。
パラメータ:single イメージ (イメージ コレクションを除く)。
Returns: Coordinates. For example:(-65,90)
例:
set PointAdjustment to ImageHotSpot("Logo") - imageSize("Logo")//画像の右下角とホットスポットとの差を見つけます。
例:
log imagehotspot("CompanyLogo")