スクリプト実行の値変更について
Windows10 WinActor ver7.2.1を利用しています。
スクリプト実行の内容が以下のようになっています。
チェックボックスの戻り値を変更したいと思っています。
✔した時、True
✔がない時、False
で$結果3$~$結果10$にはいっています。
Trueの値、Falseの値を変更するにはどうすればよいかご教授願います。
cmd = "powershell.exe -command """ & _
"Add-Type -AssemblyName System.Windows.Forms;" & _
"$form=New-Object System.Windows.Forms.Form;" & _
"$form.Size='400,300';" & _
"$form.Startposition='CenterScreen';" & _
"$form.FormBorderStyle='FixedSingle';" & _
"$form.ControlBox=$false;" & _
"$form.Text='処理条件入力';" & _
"$label1=New-Object System.Windows.Forms.Label;" & _
"$label1.Location='10,20';" & _
"$label1.Size='350,20';" & _
"$label1.Text='検索結果表示件数(半角数字で入力 デフォルト:5)';" & _
"$textBox1=New-Object System.Windows.Forms.TextBox;" & _
"$textBox1.Location='20,40';" & _
"$textBox1.Multiline=$True;" & _
"$textBox1.AcceptsReturn=$True;" & _
"$textBox1.AcceptsTab=$True;" & _
"$textBox1.WordWrap=$True;" & _
"$textBox1.Anchor=(([System.Windows.Forms.AnchorStyles]::Left)` " & _
"-bor ([System.Windows.Forms.AnchorStyles]::Top)` " & _
"-bor ([System.Windows.Forms.AnchorStyles]::Right)` " & _
"-bor ([System.Windows.Forms.AnchorStyles]::Bottom));" & _
"$textBox1.Size='80,20';" & _
"$textBox1.MaxLength=6;" & _
"$textBox1.Text='5';" & _
"$label2=New-Object System.Windows.Forms.Label;" & _
"$label2.Location='10,70';" & _
"$label2.Size='250,20';" & _
"$label2.Text='処理対象エリアを選択してください';" & _
"$CheckedBox1=New-Object System.Windows.Forms.CheckBox;" & _
"$CheckedBox1.Location='20,90';" & _
"$CheckedBox1.Size='100,20';" & _
"$CheckedBox1.Text='国関連';" & _
"$CheckedBox2=New-Object System.Windows.Forms.CheckBox;" & _
"$CheckedBox2.Location='20,120';" & _
"$CheckedBox2.Size='100,20';" & _
"$CheckedBox2.Text='広島';" & _
"$CheckedBox3=New-Object System.Windows.Forms.CheckBox;" & _
"$CheckedBox3.Location='20,150';" & _
"$CheckedBox3.Size='100,20';" & _
"$CheckedBox3.Text='岡山';" & _
"$CheckedBox4=New-Object System.Windows.Forms.CheckBox;" & _
"$CheckedBox4.Location='150,90';" & _
"$CheckedBox4.Size='100,20';" & _
"$CheckedBox4.Text='山口';" & _
"$CheckedBox5=New-Object System.Windows.Forms.CheckBox;" & _
"$CheckedBox5.Location='150,120';" & _
"$CheckedBox5.Size='100,20';" & _
"$CheckedBox5.Text='島根';" & _
"$CheckedBox6=New-Object System.Windows.Forms.CheckBox;" & _
"$CheckedBox6.Location='150,150';" & _
"$CheckedBox6.Size='100,20';" & _
"$CheckedBox6.Text='鳥取';" & _
"$CheckedBox7=New-Object System.Windows.Forms.CheckBox;" & _
"$CheckedBox7.Location='280,90';" & _
"$CheckedBox7.Size='100,20';" & _
"$CheckedBox7.Text='東京';" & _
"$CheckedBox8=New-Object System.Windows.Forms.CheckBox;" & _
"$CheckedBox8.Location='280,120';" & _
"$CheckedBox8.Size='100,20';" & _
"$CheckedBox8.Text='その他';" & _
"$OKButton=New-Object System.Windows.Forms.Button;" & _
"$OKButton.Location='20,200';" & _
"$OKButton.Size='75,30';" & _
"$OKButton.Text='OK';" & _
"$OKButton.DialogResult=[System.Windows.Forms.DialogResult]::OK;" & _
"$CancelButton=New-Object System.Windows.Forms.Button;" & _
"$CancelButton.Location='280,200';" & _
"$CancelButton.Size='75,30';" & _
"$CancelButton.Text='Cancel';" & _
"$CancelButton.DialogResult=[System.Windows.Forms.DialogResult]::Cancel;" & _
"$form.Controls.Add($label1);" & _
"$form.Controls.Add($textBox1);" & _
"$form.Controls.Add($label2);" & _
"$form.Controls.Add($CheckedBox1);" & _
"$form.Controls.Add($CheckedBox2);" & _
"$form.Controls.Add($CheckedBox3);" & _
"$form.Controls.Add($CheckedBox4);" & _
"$form.Controls.Add($CheckedBox5);" & _
"$form.Controls.Add($CheckedBox6);" & _
"$form.Controls.Add($CheckedBox7);" & _
"$form.Controls.Add($CheckedBox8);" & _
"$form.Controls.Add($OKButton);" & _
"$form.Controls.Add($CancelButton);" & _
"$form.AcceptButton=$OKButton;" & _
"$form.CancelButton=$CancelButton;" & _
"$form.Topmost=$True;" & _
"$OKButton.Add_Click({Write-Host 'OK,'" & _
"$textBox1.Text" & _
"','" & _
"$CheckedBox1.Checked" & _
"','" & _
"$CheckedBox2.Checked" & _
"','" & _
"$CheckedBox3.Checked" & _
"','" & _
"$CheckedBox4.Checked" & _
"','" & _
"$CheckedBox5.Checked" & _
"','" & _
"$CheckedBox6.Checked" & _
"','" & _
"$CheckedBox7.Checked" & _
"','" & _
"$CheckedBox8.Checked" & _
"});" & _
"$CancelButton.Add_Click({Write-Host 'Cancel,,,,,,,,,'});" & _
"[void]$Form.ShowDialog();"""
Set objShell = WScript.CreateObject("WScript.Shell")
Set objExec = objShell.Exec(cmd)
Do While objExec.Status = 0
WScript.Sleep 300
Loop
ObjAns = Split(objExec.StdOut.ReadLine, ",")
SetUMSVariable $結果1$, ObjAns(0)
SetUMSVariable $結果2$, ObjAns(1)
SetUMSVariable $結果3$, ObjAns(2)
SetUMSVariable $結果4$, ObjAns(3)
SetUMSVariable $結果5$, ObjAns(4)
SetUMSVariable $結果6$, ObjAns(5)
SetUMSVariable $結果7$, ObjAns(6)
SetUMSVariable $結果8$, ObjAns(7)
SetUMSVariable $結果9$, ObjAns(8)
SetUMSVariable $結果10$, ObjAns(9)
Set objExec = Nothing
Set objShell = Nothing