PowerShell -Part 7 (615レス)
PowerShell -Part 7 http://mevius.5ch.net/test/read.cgi/tech/1701241669/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
レス栞
リロード規制
です。10分ほどで解除するので、
他のブラウザ
へ避難してください。
419: デフォルトの名無しさん [sage] 2025/03/07(金) 23:19:13.53 ID:6K+ignj1 Add_Clickに渡したスクリプトブロックが実行されるのはボタンクリック時。 その時にはもうsetSelectButtonを抜けてるから、setSelectButton実行時に渡した$folderTypeはもう見えない。 最後の手段的なglobalスコープの使用を避けて手っ取り早く解決するなら、 {〜〜〜}.GetNewClosure()でsetSelectButton実行中の変数スコープを記憶(?)したうえで 自前のクラスとかハッシュテーブル等で入出力しちゃう。とか。適当実装だとこんな。 function setSelectButton($def){ $conf = New-Object System.Windows.Forms.Button $conf.Location = New-Object System.Drawing.Point($def.xAxis,$def.yAxis) $conf.Size = New-Object System.Drawing.Size($def.xSize, $def.ySize) $conf.Text = "Select" $conf.Add_Click({ $dialog_FolderSelection = New-Object Windows.Forms.FolderBrowserDialog if($dialog_FolderSelection.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK){ $def.textBox.Text = $dialog_FolderSelection.SelectedPath } }.GetNewClosure()) return $conf } (略) $inputDef = [Ordered] @{xAxis = 370; yAxis = 50; xSize = 70; ySize = 20; textBox = $textBox_inputFolder;} $outputDef = [Ordered] @{xAxis = 370; yAxis = 70; xSize = 70; ySize = 20; textBox = $textBox_outputFolder;} # create Select button $button_Select_inputFolder = setSelectButton $inputDef $button_Select_outputFolder = setSelectButton $outputDef (略) if([String]::IsNullOrEmpty($inputDef.textBox.Text)){ # show a message dialog if no file is selected ※これで入力欄にフォルダパスをコピペする人(=私)も安心 http://mevius.5ch.net/test/read.cgi/tech/1701241669/419
421: デフォルトの名無しさん [] 2025/03/09(日) 07:42:20.13 ID:RXTu5Tqn >>419 ありがとうございます! setSelectButton実行時に渡した$folderTypeはもう見えないんですね。 http://mevius.5ch.net/test/read.cgi/tech/1701241669/421
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.030s