Thanks.
Update: maybe Don can provide a command for this. Just wondering.
Code: Select all
Wait(milliseconds);that's what tried to do.TheQwerty wrote:It should beat creating a recursive loop with conditional subs.
Code: Select all
setkey 0, test,test,"test.ini";
sub _test;
"_test"
getkey $test, test,test,"test.ini";
incr $test;
$next = ($test < 10)?_test:_end;
msg "$test/10 clicks<crlf>Next step = $next";
setkey $test, test,test,"test.ini";
sub $next;
"_end"
getkey $test, test,test,"test.ini";
msg "The script ended with $test of 10 clicks.<crlf>Try again?",1;Oh sorry, I misread your post. Thanks again.Muroph wrote:that's not a timer.
it's a script to show a bug that i found while trying to make the timer.
Code: Select all
"Slideshow : slideshow"
inputfolder $folder, <curpath>, "Select folder";
goto $folder;
setting HideFoldersInList, 1;
sel 1;
sub slide;
"_slide : slide"
//Full screen preview
#1003;
wait (3000);
sel +1;
sub slide
Code: Select all
"Slideshow : slideshow"
inputfolder $folder, <curpath>, "Select folder";
goto $folder;
setting HideFoldersInList, 1;
sel a;
getinfo $count, "CountSelected";
copytext $count;
//Find panel
#260;
//Preview panel
#174;
//maximize info panel
#667;
//Maximize window
#1028;
sel 1;
sub slide;
"_slide : slide"
wait (3000);
sel +1;
set $count, <clipboard>;
incr $count, $count, -1;
copytext $count;
$eval= $count > 0 ? "slide" : "end";
sub $eval
"_end : end"
//Restore window size
#1029;
//Last info panel size
#666;
status "End of Slideshow";
Oh, yes, interesting. The comparison is not numerical but alphabetical, so "2" > "10"!Muroph wrote:that's what tried to do.TheQwerty wrote:It should beat creating a recursive loop with conditional subs.
but i found a possible bug.
try this script.
recursion checker must be off.if i didn't screw up, it should make you click "ok" 10 times before ending.Code: Select all
setkey 0, test,test,"test.ini"; sub _test; "_test" getkey $test, test,test,"test.ini"; incr $test; $next = ($test < 10)?_test:_end; msg "$test/10 clicks<crlf>Next step = $next"; setkey $test, test,test,"test.ini"; sub $next; "_end" getkey $test, test,test,"test.ini"; msg "The script ended with $test of 10 clicks.<crlf>Try again?",1;
but looks like the conditional doesn't work when the script calls itself.
on the second loop the condition "$test>=10" will be evaluated true when it should be false, since $test==2.
Code: Select all
<?php
$test = "2";
echo ($test < "10")?"True":"False";// True
echo ($test < 10)?"True":"False";// True
$test = 2;
echo ($test < "10")?"True":"False";// True
echo ($test < 10)?"True":"False";// True
$test = "a2";
echo ($test < "a10")?"True":"False";// False!
echo ($test < 10)?"True":"False";// True ("a2" is probably evaluated as numeric 0)
?>You can garner the valid scripting commands by looking at XYplorer.exe in Raw Preview (or any hex editor), but you'll have to guess if there are parameters and what they are.serendipity wrote:Thanks guys, much appreciated.
@TheQwerty:, how did u get the info about the command "wait(milliseconds)"? Thats what I precisely wanted.
I almost think that it might be best that if either operand is within quotes you should treat it as a string comparison, otherwise numeric.admin wrote:I guess it checks whether one of the compared operands is numerical and then applies a numeric comparison. Should I do that too? I'd think so. I would not like to add special operators for string vs. numeric comparison.
But the state of being quoted is lost once the operand is set to a variable:TheQwerty wrote:I almost think that it might be best that if either operand is within quotes you should treat it as a string comparison, otherwise numeric.admin wrote:I guess it checks whether one of the compared operands is numerical and then applies a numeric comparison. Should I do that too? I'd think so. I would not like to add special operators for string vs. numeric comparison.
Code: Select all
msg (2 < "10"); // would be 1
msg ("2" < "10"); // would be 0
$a = 2; msg ($a < "10"); // would be 1?
$a = "2"; msg ($a < "10"); // would be 1?Code: Select all
function compare (operator, op1, op2, [comparetype=string|numeric])i like qwerty's idea, but i don't think you got it right here.admin wrote:But the state of being quoted is lost once the operand is set to a variable:Code: Select all
msg (2 < "10"); // would be 1 msg ("2" < "10"); // would be 0 $a = 2; msg ($a < "10"); // would be 1? $a = "2"; msg ($a < "10"); // would be 1?
Code: Select all
msg (2 < 10); //number, would be 1
msg (2 < "10"); //string, would be 0
msg ("2" < "10"); //string, would be 0
$a = "2"; msg ($a < 10); //number, would be 1
$a = 2; msg ($a < "10"); //string, would be 0
$a = 2; msg ("$a" < 10); //string, would be 0Might be wrong there, but I think PHP does numerical comparison no matter what. To do string comparisons, there are special functions. IMO that's be the right thing to do here as well, do numerical comparisons for now, maybe later add a function to do a string comparison...admin wrote:I guess it checks whether one of the compared operands is numerical and then applies a numeric comparison. Should I do that too? I'd think so.
Is this a numerical comparison? Should be True then, or? But is False...jacky wrote:Might be wrong there, but I think PHP does numerical comparison no matter what. To do string comparisons, there are special functions. IMO that's be the right thing to do here as well, do numerical comparisons for now, maybe later add a function to do a string comparison...admin wrote:I guess it checks whether one of the compared operands is numerical and then applies a numeric comparison. Should I do that too? I'd think so.
Code: Select all
echo ("2a" < "10a")?"True":"False";// False!