これが私の AHK スクリプトです:
Gui, Add, Edit, x77 y15 w100 h30 vMyvar gEdit1 ;first edit box, there can be entered any value.
Gui, Add, Edit, x237 y15 w100 h30 vNewvar Disabled, %Newvar% ;second edit box it shows the result by multiplying the first edit box's value by 100.
Gui, Add, Edit, x72 y60 w100 h30 vMyv gEdit2 ;third edit box, there can be entered any value.
Gui, Add, Edit, x242 y60 w100 h30 vNewv Disabled, %Newv% ;fourth edit box it shows the result by multiplying the second edit box's value by 50
Gui, Add, Edit, x242 y110 w100 h30 vTotal Disabled ;this edit box shows the total of %Newvar% and %Newv% i.e. second edit box and fourth edit box.
Gui, Add, ListView, x282 y200 w100 h300 , 100|50|total ;listview box which lists the values of first edit box and third edit box
Gui, Add, Button, x62 y120 w100 h30 gNext, NEXT ;next botton which when pressed lists the values of first edit box and third edit box and also clears the second edit box and fourth edit box everytime it pressed.
Gui, Show, w473 h373, Untitled GUI
return
Edit1:
Gui, Submit, NoHide
NewVar := Myvar * 100
GuiControl,, Newvar, %Newvar%
gosub, SetTotal
return
Edit2:
Gui, Submit, NoHide
NewV := Myv * 50
GuiControl,, Newv, %Newv%
gosub, SetTotal
return
SetTotal:
Total := 0
if NewVar is number
Total += NewVar
if Newv is number
Total += Newv
GuiControl,, Total, %Total%
return
Next:
Gui, Submit, NoHide
LV_Insert(1,, Myvar, Myv, Total)
Newvar := ""
Newv := ""
Total := ""
GuiControl,, Newvar, %Newvar%
GuiControl,, Newv, %Newv%
GuiControl,, Total, %Total%
return
この GUI に次のコントロールを追加します。
Gui, Add, ListView, x62 y170 w200 h300 , s no|100|50|total ; this listview box is for negative values and i added s no column also in it which should contain the serial no as the negative values are entered in this box.
Gui, Add, ListView, x282 y170 w200 h300 , s no|100|50|total ; same listview box for positive values.
Gui, Add, Text, x402 y20 w130 h20 , no of negative values
Gui, Add, Text, x402 y50 w130 h20 , total of negative value
Gui, Add, Edit, x542 y20 w100 h20 , ;in this edit box i want that there should come only the total no of negative values. say there are 10 nagative values in negative listview box then it should contain only no 10
Gui, Add, Edit, x542 y50 w100 h20 , ; in this edit box i want that it should contain the total of all the negative values i.e. if the total of all 10 negative value is say 50000 then it should contain 50000.
GuiClose:
ExitApp
リストビュー ボックスを 2 つ作成し、そのうちの 1 つに正の値をリストし、もう 1 つに負の値をリストします。合計 (3 番目の編集ボックスには %Newvar% と %Newv% の合計が表示されます) が正の場合は正の値のリストビュー ボックスにリストされ、負の場合は負の値のリストビュー ボックスにリストされます。さらに、負と正のリストビュー ボックスの両方に、番号 (シリアル番号) 列も必要です。さらに 2 つの編集ボックスを作成し、負の値の数を入力し、別の編集ボックスにすべての負の値の合計を入力する必要があります。
答え1
プログラムの流れは次のようになるようです:
- GUI 1では、ユーザーが項目を入力し、「次へ」をクリックすると、テーブルに追加されます。
- GUI 2では、GUI 1のテーブルの項目がテーブルA(ポジティブ)とテーブルB(ネガティブ)に分類されます。
おそらく、次の調整を行う必要があると思われます。
- GUI1 に、GUI2 に進むための別のボタンを追加します。これを「Proceed」ボタンと呼びます。
- 「続行」ボタンを押すと…
- GUI1を非表示
- 完成したGUI1テーブル内のすべての値をループします。
- 各値について、それが負か正かに基づいて、GUI2テーブル(またはそのテーブルに書き込まれる変数)の1つに追加します。
- すべての数字が対応するテーブルに処理されたら、GUI2を表示します。
- GUI2を2番目のGUIにするには、上記のコードをリファクタリングする必要があります(複数のGUIを使用する場合は、必要に応じてヘルプファイルを参照してください。基本的には、すべてのコマンドの前にGUI番号を追加するだけです)。