Parsing bug when having comments and/or nested IF's?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Parsing bug when having comments and/or nested IF's?

Post by Grovkillen » Tue Nov 17, 2020 9:44 am

This is part of a bigger script but I want to show what appears to be a bug. Please look at the linked GIF.

Image

I demonstrate the issue with this code.

Code: Select all

Let>DO_SOMETHING_WITH_THE_FILE_Var_1=.xls#
  UpperCase>DO_SOMETHING_WITH_THE_FILE_Var_1,DO_SOMETHING_WITH_THE_FILE_Var_1
  If>{(%DO_SOMETHING_WITH_THE_FILE_Var_1% = ".XLSX") OR (%DO_SOMETHING_WITH_THE_FILE_Var_1% = ".XLS")}
    //tabort nedan
    IfFileExists>%FILE1%
      DeleteFile>%FILE1%
    Endif>
    IfFileExists>%FILE2%
      DeleteFile>%FILE2%
    Endif>
    //tabort ovan
    IfFileExists>%DSWTF_TEMP_2%\%DSWTF_TEMP_1%.pdf
      RenameFile>%DSWTF_TEMP_2%\%DSWTF_TEMP_1%.pdf,%DSWTF_TEMP_2%\%DSWTF_TEMP_1% [omdöpt].pdf
    Endif>
    IfFileExists>%APPS_PATH%\metadata.findings
      DeleteFile>%APPS_PATH%\metadata.findings
    Endif>
    IfFileExists>%DSWTF_TEMP_2%\%DSWTF_TEMP_1%%DSWTF%.pdf
      Let>COMMAND_LINE_SWITCHES=cmd /c %VOLUME_LETTER%: & "%APPS_PATH%\exiftool.exe" -s -s -s -keywords "%DSWTF_TEMP_2%\%DSWTF_TEMP_1%%DSWTF%.pdf" > "%APPS_PATH%\metadata.findings"
      Run>COMMAND_LINE_SWITCHES
      Let>DSWTF_loop=0
      Label>DSWTF_startover
      IfNotFileExists>%APPS_PATH%\metadata.findings
        Wait>0.1
        Add>DSWTF_loop,1
        If>DSWTF_loop<2
          Goto>DSWTF_startover
        Endif>
      Endif>
      If>DSWTF_loop<2
        ReadFile>%APPS_PATH%\metadata.findings,TEMP_FILE_PDF_META_DATA_EPOCH
        DeleteFile>%APPS_PATH%\metadata.findings
        Let>TEMP_TEST=TEMP_FILE_PDF_META_DATA_EPOCH*0
        IfNot>TEMP_TEST=0
          Let>TEMP_FILE_PDF_META_DATA_EPOCH=0
        Endif>
      Else>
        Let>TEMP_FILE_PDF_META_DATA_EPOCH=0
      Endif>
    Else>
      Let>TEMP_FILE_PDF_META_DATA_EPOCH=0
    Endif>
    If>TEMP_FILE_PDF_META_DATA_EPOCH<EPOCH_STAMP
      DeleteFile>%DSWTF_TEMP_2%\%DSWTF_TEMP_1%%DSWTF%.pdf
    Endif>
    IfNotFileExists>%DSWTF_TEMP_2%\%DSWTF_TEMP_1%%DSWTF%.pdf
      GoSub>FILE_EXTENSION_XLSX,%DSWTF_TEMP_2%,%DSWTF_TEMP_1%,%DO_SOMETHING_WITH_THE_FILE_Var_1%
    Endif>
  Endif>
Let>ME=%Script%

Running: 15.0.24
version history

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Parsing bug when having comments and/or nested IF's?

Post by Dorian (MJT support) » Tue Nov 17, 2020 11:14 am

I can't seem to replicate what's happening in your gif. Each time it's simply jumping to the end.

Tested in 14.5.6 Pro, 15.0.13 Pro, and 15.0.14 Pro.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Parsing bug when having comments and/or nested IF's?

Post by Grovkillen » Tue Nov 17, 2020 2:33 pm

Thanks for the update. My machine still "misbehave" with this but I've made a work around so it's no sweat.
Let>ME=%Script%

Running: 15.0.24
version history

user5274
Junior Coder
Posts: 43
Joined: Tue Aug 04, 2020 9:35 am

Re: Parsing bug when having comments and/or nested IF's?

Post by user5274 » Tue Nov 17, 2020 9:45 pm

As a courtesy i also ran the above code as-is, it worked as normal and jumped to the correct location as expected. on Registered MS15.0.14. No word yet on my If> problems, I had to visit 'another' site to get a hint of my problem :(
Last edited by user5274 on Thu Nov 26, 2020 4:11 am, edited 1 time in total.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Parsing bug when having comments and/or nested IF's?

Post by Dorian (MJT support) » Tue Nov 17, 2020 10:19 pm

user5274 wrote:
Tue Nov 17, 2020 9:45 pm
As a courtesy i also ran the above code as-is, it worked as normal and jumped to the correct location as expected. on Registered MS15.0.14. No word yet on my If> problems, I had to visit the Indian version of pirate bay MS15 forums to get a hint of my problem, its amazing how large of an Indian following of cracked MS15 Enterprise has whereas valid paid Pro customers cannot get answers. :(
Dev is investigating this. If it is indeed a bug, a fix will be worked on.
Yes, we have a Custom Scripting Service. Message me or go here

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

Re: Parsing bug when having comments and/or nested IF's?

Post by Marcus Tettmar » Sat Nov 21, 2020 3:33 pm

I cannot replicate this. With your code the variable is set such that it won't branch into the if. If I remove the # it correctly steps into the if and steps through as I would expect.
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
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Parsing bug when having comments and/or nested IF's?

Post by Grovkillen » Sun Nov 22, 2020 3:01 am

Ok, yes the # is there just as a test.
Let>ME=%Script%

Running: 15.0.24
version history

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