The Unofficial Macro Scheduler Puzzler of the Week 2

Anything Really. Just keep it clean!

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

The Unofficial Macro Scheduler Puzzler of the Week 2

Post by JRL » Sat Sep 21, 2013 4:12 am

Ok... so the first puzzler seemed to be received well. Let's do it again.

For the under 50 (posts) crowd, what's wrong with my math? Why won't this script complete properly? 20 rep points for the first correct answer.

Code: Select all

Let>r=0
Repeat>r
  Let>r=r+2.3
  If>{(%r%>0)and(%r%<4)}
    Let>r={%r%/1.6}
    WriteLn>%temp_dir%Repeat_Result.txt,r,The sequential quotient value is %r%
  EndIf
Until>r>5
For the more experienced, Which Macro Scheduler function will not work properly if indented? Again 20 rep points for the first correct answer.

hagchr
Automation Wizard
Posts: 327
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Post by hagchr » Sat Sep 21, 2013 10:24 am

The variable r is used twice (repeat counter and result of WriteLn) and gets reset to zero in the loop. This leads to a loop doing the same thing each time.

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sun Sep 22, 2013 4:23 am

hagchr,

Congrats! You are the winner!

This was actually an attempt to point out a pet peeve of mine which is single character variables. Not that a scripter couldn't use a longer variable twice and have the same problem. In my experience, its less likely when using variables that are descriptive, to use the same variable for a loop counter and for a Writeln> result.

For example if the loop counter variable was "initval" (short for initial value) and the Writeln> result variable was "wres" (short for write result), its very unlikely one would ever be substituted for the other.

Anyone made any progress on the advanced question?

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Sep 27, 2013 2:05 pm

Puzzler of the Week 2 wrote:For the more experienced, Which Macro Scheduler function will not work properly if indented?
.............A week has passed with no response to the puzzler.


I can't believe no one even responded to this. Maybe its because the question was perhaps a tad misleading since the answer might not really a Macro Scheduler "function". The answer I was looking for is Dialog>. Not really sure what you should call it if not "function".

In any case no one wins the 20 rep points. The good news is there will be a puzzler number 3, so everyone will have another chance to win.

Yippie

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Wed Oct 02, 2013 5:18 am

Hi JRL,

Interesting, how did you find out that the Dialog> command wouldn't work properly if indented?

I tried it just now on one of the Dialog example macros... I indented the entire Dialog definition using Edit/Block Indent in the MS Editor... then ran it with the following error...

---------------------------
Macro Scheduler
---------------------------
Cannot open file "C:\Users\Owner\Documents\Macro Scheduler 14\Dialogs - Simple Modal.scp". The system cannot find the file specified.
---------------------------
OK
---------------------------

Any idea why Dialog> is doing this? It seems odd that any other command can handle being indented yet Dialog can't. Is there some special reason?

Marcus, any thoughts?
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Oct 02, 2013 1:58 pm

jpuziano wrote:Interesting, how did you find out that the Dialog> command wouldn't work properly if indented?
I indented one and it didn't work. I often start a long script with a "Setup" subroutine. I put dialogs and database initializations and stuff like that in there. I can then move it to the bottom of the script so its out of the way yet really keep it at the start of the script with the one line GoSub>Setup. Plus, I like to indent whatever is in a subroutine and so found out years ago to not indent the dialogs which are often in the Setup subroutine.

jpuziano wrote:Any idea why Dialog> is doing this?
Did you not read the subject line? It's a puzzler... :wink:

Actually it is a Delphi thing and probably not important enough to worry about. In my 12 years of Macro Scheduling, I've never heard it mentioned until now. Most Macro Scheduler users never create a dialog and of those few who do most of them will never alter what the dialog builder creates.

If you disagree that its not important, HERE'S a starting point for you to issue a complaint.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts