Suggested addition for Complex Expressions

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Suggested addition for Complex Expressions

Post by Jerry Thomas » Fri Dec 07, 2012 8:27 pm

A common scenario is to read a file and act on each line, until the end of the file (##EOF##).
I use this approach to loop through, and thought it might be worth adding to the Complex Expressions help page.

Code: Select all

Let>EOF=##EOF##

Let>DataFile=%DESKTOP_DIR%\SomeFile.txt
Let>DataStr=default_text
Let>cnt=0

While>{Not(%DataStr%=%EOF%)}
  Let>cnt=cnt+1
  ReadLn>DataFile,cnt,DataStr
  //do stuff
EndWhile
Thanks,
Jerry

[email protected]

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Dec 12, 2012 4:11 pm

Hi,

Horses for courses but this looks like a rather complicated way of just saying:

While>DataStrEOF
..

Never-the-less I have made a note to consider as an additional example.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Wed Dec 12, 2012 4:48 pm

I have had so much trouble with in the past, that I don't consider that an option. Has this been impoved in recent releases (V12 specifically).

If your sample works, that will be much easier. I will try it.

Thanks
Thanks,
Jerry

[email protected]

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Dec 12, 2012 5:07 pm

just means not equal. Don't think it has ever changed. What issues have you had?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Wed Dec 12, 2012 6:20 pm

I understand , but just had trouble getting it to work at all.
It would always evaluate as false (ie; just skip the while loop).

Let me try it again on some existing code I have, that needs this functionality...
Thanks,
Jerry

[email protected]

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Hello

Post by PepsiHog » Fri Dec 28, 2012 4:25 pm

@Marcus,

I second what Jerry said. I also have noticed that doesn't work as it should. I usually find a way of not using in any of my arguments.

@Jerry

Thanks for the extra complex expression. Didn't know it could be done like that. COOL!

PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Dec 28, 2012 5:32 pm

Please send me an example of not working as it should. I've used it routinely for likes 15 years. So please show me.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Feb 11, 2013 3:34 pm

Now that we have the new commenting feature on the online manual can I suggest that you post this example there?

http://www.mjtnet.com/manual/index.html?examples.htm

And I'm still waiting for info on the "" issue you both have. Please enlighten me.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Mon Feb 11, 2013 5:11 pm

I ran into this some time back and haven't tried it recently.
I know I have a comment about some ugly work around in an old script but haven't found it yet.
Thanks,
Jerry

[email protected]

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

hello

Post by PepsiHog » Mon Feb 11, 2013 11:32 pm

I haven't forgotten about this post. When I come across an example I will post it.

Just to clearify. It doesn't always fail.

PepsiHog
Last edited by PepsiHog on Fri Feb 15, 2013 11:53 pm, edited 1 time in total.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Feb 12, 2013 7:29 am

It really is not wishy washy.

There are thousands of Macro Scheduler scripts in existence around the world which make basic not equal comparisons using and I have never in 16 years of Macro Scheduler seen a problem with it.

Rather than make statements which might concern prospective customers please provide an example of the issue you are experiencing If you don't have one then try it. Please show me what you mean by "wishy washy".

Clear and simple test:

Code: Select all

If>1<>2
  yup that works
Endif
This is such a basic and important feature of any language that I need to reassure people that there is no issue with it. None has been reported, no bug for it exists in our bug tracker, I have never seem an issue with it, I see other people's scripts every day that use it.

If your comparison doesn't work as you expect there is only one sensible conclusion: the values or variables you think are different are not and the issue must therefore be with your variable assignations or with whatever it is you are comparing and may be caused earlier in the script (e.g. maybe you are confusing a literal with a variable and so on).

If you have problems post them and we'll help. Stating functionality as "wishy washy" without backing that up doesn't help anyone.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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

Post by JRL » Tue Feb 12, 2013 5:26 pm

I'm hesitant to say anything here because I don't want to risk offending anyone. I have to agree with Marcus. I use not equal "" all the time and it is as reliable as equal "=". I have never seen an instance where there was a problem using not equal

I wondered how often I've used it so I wrote a little script to look through my current script directory to see how often "" showed up. The following script provides me with the following information.

206 of 1061 files contain a total of 587 instances of ""

I would also like to emphasize that this is my current v13 script folder. I tend to let my script folder go empty with each new version of Macro Scheduler. I do bring forward some scripts as I need them but many only reside in the folder for the version I was using when they were created. I've been using Macro Scheduler since version 6 and I have written a lot of scripts. Not equal has never failed for me.
[b]Jerry Thomas[/b] wrote:I know I have a comment about some ugly work around in an old script but haven't found it yet.
Jerry I looked through all your old posts and the closest I came to finding a mention of an issue with "" was back in 2010 you had a problem using conplex expressions in a While> loop. Specifically that issue was with "=". While> was introduced in 2010 and Marcus acknowledged and fixed the problem straight away.


How often have you used ""? This script can tell you.

Code: Select all

GetFileList>%script_dir%\*.scp,vData,;
Separate>vData,;,vline

Let>vFileCount=0
Let>vNotEqualCount=0
Let>kk=0
Repeat>kk
  Add>kk,1
  Let>value=vline_%kk%
  Message>%kk% %value%
  ReadFile>value,vData
  Separate>vData,<>,vPart
  If>vPart_Count>1
    Sub>vPart_count,1
    Add>vNotEqualCount,%vPart_Count%
    Add>vFileCount,1
  EndIf
Until>kk=vline_count

MDL>%vFileCount% of %kk% files contain a total of %vNotEqualCount% instances of "<>"

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Feb 12, 2013 5:40 pm

I'm with JRL, I'm a long time user and I can't ever recall a problem with that wasn't due to my own error.

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

Post by jpuziano » Tue Feb 12, 2013 5:55 pm

Hi JRL,

Cool script... here's the results for my MS 12 install:

200 of 475 files contain a total of 1905 instances of ""

I haven't seen an instance of not working either... however if anyone out there can come up with such an example, I heartily encourage you to post it.

I am all for fixing bugs if they exist... In fact I think posters who find bugs and take the time and effort to post about them should be rewarded with points the same way you might reward someone who helped you with a solution to a problem you post here.

In fact, it might be even MORE worthy of points... because any bug found and fixed makes life better for us all.

Oh alright... since I've thrown down the gauntlet... here's an open challenge to ALL:

100 points to the first person posting a script example ON THIS THREAD showing a problem with

Any takers?
Last edited by jpuziano on Tue Feb 12, 2013 9:47 pm, edited 1 time in total.
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
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Tue Feb 12, 2013 6:55 pm

Me_again wrote:I'm with JRL, I'm a long time user and I can't ever recall a problem with that wasn't due to my own error.
Ditto, what Me_again said.


286 of 563 files contain a total of 1345 instances of ""

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