For the current command "msg" we can already use several parameter:
msg text, [buttons], [linebreaker="<br>"]
msg text; //OK -button
msg text,1; //OK Abbrechen -buttons
msg text,2; //Abbrechen Wiederholen Ignorieren -buttons
msg text,3; //Ja Nein Abbrechen -buttons
msg text,4; //Ja Nein -buttons
msg text,5; //Wiederholen Abbrechen -buttons
msg text,6; //Abbrechen Wiederholen Weiter -buttons
I get the MsgBox with this buttons, but i don't know to get the pressed return.
What i suggest is to turn msg into an function and return the button pressed.
This way we could let the user choose from more then two possibilities but e.g. three .
Example script:
Code: Select all
$UserChoice = msg("Do you want to continue with debugging (Yes) ,
without debugging (No) or cancel the whole script (Cancel)?", 3 );
IF($UserChoice == 1){ step; }
IF($UserChoice == 3){ end(1); }Also using the "Yes" and "No"-buttons instead of the OK/Cancel would be nifty often.
As addition or as an other idea i could imagine this command
msg text,7; // [1] [2] [3] -buttons
msg text,8; // [1] [2] [3] [4] -buttons
msg text,9; // [1] [2] [3] [4] [5] -buttons
Code: Select all
$a = msg("Press [1] for files, [2] for folders or [3] to cancel", 7);
if ($a==1){....;}- - -
Till then,
as an work around we can use inputselect()
Code: Select all
$Choice1 = "No1 with an long describtion";
$Choice2 = "Second entry: do nothing, just end";
$Choice3 = "Third possibility";
$Choice4 = "Just make coffee";
$Choice5 = "And there was sound!...";
$Choice6 = "Ask me again..."; //will only work if this script is an file
////inputselect(header, listdata, [separa=|], [style=1], [cancel], [width], [height], [caption])
$ASK = inputselect("Chose one of this choices:",
$Choice1|$Choice2|$Choice3|$Choice4|$Choice5|$Choice6 , , , "Canceled", 200, 250, "Choices Test Dialog");
If ($ASK==$Choice1){msg "Your choice is: No1";}
If ($ASK==$Choice2){;}
If ($ASK==$Choice3){msg "OK, OK, choice number 3.";}
If ($ASK==$Choice4){makecoffee;}
If ($ASK==$Choice5){ while($loop<3){ beep; beep 1000, 200;beep 1200, 400; incr $loop; wait 500; }}
If ($ASK==$Choice6){ setting "AllowRecursion"; self $ScriptFile, file; Load $ScriptFile, Store; break; }
If ($ASK=="Canceled"){ msg "Canceld by user";}
.
XYplorer Beta Club