IDE corrupts scp files

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

IDE corrupts scp files

Post by NancyM » Fri Jul 29, 2016 4:14 pm

Okay, I've had this happen a couple times now. Running a script with Include files while you've got the include files open in the editor, in a new window, may overwrite the other code with the code from the main script.

For instance, I have a script called LoanSales.scp that includes Database.scp. If I run LoanSales.scp then there's a chance my Database.scp will be overwritten with the contents of LoanSales.scp.

I've also had an issue with stopping a run and the include files remain included as code in the main script.

If you know a way to work around these issues, please share!

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: IDE corrupts scp files

Post by NancyM » Fri Jul 29, 2016 5:32 pm

Wow... this isn't just if it is open in the editor. I tried closing it and running my script and it overwrote the file with the main routines code.

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

Re: IDE corrupts scp files

Post by JRL » Fri Jul 29, 2016 5:59 pm

In the editor, under the "Debug" menu, uncheck "Save on Run/Debug".

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

Re: IDE corrupts scp files

Post by Marcus Tettmar » Thu Aug 04, 2016 11:56 am

I can't replicate this. SaveOnRun only saves the original file *before* the script is executed and therefore saves it *before* the Include has be actioned.

So the issue is not SaveOnRun. But regardless of that option I can't replicate Include causing a corruption.

I also don't understand how the Included script could be overwritten by the main calling script as you suggest. I just can't see why that would ever happen.

Which version are you using and are you able to provide a screencast demonstrating the problem occurring so that I can try and replicate your steps precisely.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Jerryth31
Newbie
Posts: 19
Joined: Wed Jun 18, 2008 6:03 pm

Re: IDE corrupts scp files

Post by Jerryth31 » Thu Aug 04, 2016 1:24 pm

I have run into this issue several times too.

I actually include the "Include" line twice with the first one commented out so I can easily restore it.

It doesn't happen every time, and no consistent repro.
Often enough to be a real pain though.

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: IDE corrupts scp files

Post by NancyM » Fri Aug 05, 2016 8:57 pm

Which version are you using and are you able to provide a screencast demonstrating the problem occurring so that I can try and replicate your steps precisely.
I think unchecking save on run helped a lot, although it is still happening from time to time. I'm backing up my scripts twice a day just in case.

I think I can reproduce it by setting breakpoints and not realizing my scripts is still running. Then I try to save or do something and that was when it was getting corrupted. I think...

Running version 14.3

Just today I had a weird thing happen to my "Group". It seemed to add an empty SCP file to the group and when I deleted the odd SCP file entry from the group, it deleted the whole macro group and directory. Fortunately I was able to retrieve it from the recycle bin. Maybe this is tied to using group?

I haven't figured out how to reproduce it reliably just yet. When I do, you'll be the first to know!

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: IDE corrupts scp files

Post by NancyM » Mon Aug 08, 2016 3:22 pm

This morning had a new symptom. In one of my include files I had hidden the top subroutine by pressing the '-' sign. Ran the program, it aborted due to an error. Then I went into my main program, with the Include statements, and it had been overwritten by the include file, including the closed subroutine.

I exited MS all the way then went back in, problem still there. Then I clicked on the "+" sign to display the closed subroutine and my main program came back, entirely intact.

So... I'm kind of wondering if this issue only happens to programs that abort? I'm also wondering if the issue is that the files are okay, but the IDE is confused and displaying the wrong contents in the file you're editing? Maybe a cache somewhere?

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

Re: IDE corrupts scp files

Post by Marcus Tettmar » Mon Aug 08, 2016 8:46 pm

Interesting - still unable to replicate but will keep trying :-/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: IDE corrupts scp files

Post by NancyM » Fri Aug 12, 2016 3:30 pm

Here's an example of one of the weird things I'm experiencing. I "closed" up some of the functions in another file included by this file. Ran the program, hit a breakpoint, stepped through a bit of code and then hit the big red X to stop executing.

I saw my main program file has overwritten my included file and switching over to the main file I saw what's in the image I've uploaded. All those closed code sections are appearing in the main program file.

My main program file has about 5 Include files in it, if that makes a difference in reproducing things.

Oh yeah, one other thing. This screenshot was after I exited without saving and then restarted and reopened the main program file. It still has those weird artifacts in there. I click on the "+" and they go away.

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

Re: IDE corrupts scp files

Post by Marcus Tettmar » Tue Aug 16, 2016 12:34 pm

Are you able to zip up all the script files (with include files) and send to support? Include the breakpoints and explain which lines to step through ...
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: IDE corrupts scp files

Post by NancyM » Tue Aug 16, 2016 3:59 pm

Yes, I'll get to that today for you. There's a lot of stuff that will break like database stuff, applications you don't have, etc. Do you want the image files?

I still can't reproduce it reliably, so I'm not sure I can tell you exactly how to do it. But hopefully I can spend some time experimenting today.

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: IDE corrupts scp files

Post by NancyM » Tue Aug 23, 2016 8:13 pm

Was able to produce the issue by doing this:

Started debugging and then switched to another tab, tried to edit the file because I forgot I was debugging. It wouldn't let me update the tab (include file). Hit the red-x to stop the debugger. Main file overwrote contents of the tab.

Exited without saving and restarted. Everything looks good again.

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

Re: IDE corrupts scp files

Post by Marcus Tettmar » Wed Aug 24, 2016 10:14 am

How did you manage to switch tabs? When I am debugging I am unable to even switch tabs. If I stop debugging the other tabs are left alone.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: IDE corrupts scp files

Post by NancyM » Wed Aug 24, 2016 7:50 pm

Okay, some combination of **BREAKPOINT**, hitting F8/F9 and hitting another breakpoint. I'll try to pin it down exactly. But I'm able to switch back and forth between tabs during debugging. It is pretty disastrous to do and usually only happens when I forget I'm in debugging mode.

Okay, here's how it went down:

1) hit break point, step through a few lines
2) F9 to continue execution
3) Focus is given to another window
4) Breakpoint stops execution
5) Move cursor back to MS and now I can switch tabs.

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: IDE corrupts scp files

Post by NancyM » Thu Aug 25, 2016 2:19 pm

After I figured this out, and replicated to make sure I was right, I had a really bad thing happen. Not only did one of my files get corrupted, but I couldn't connect to the database and the Year> function (all the date functions) started returning garbled characters. I stopped MS and reloaded everything, still kept acting badly. Then I stopped the msched.exe in background and reloaded again. Still a problem.

I deleted the .dat file in the directory and restarted again. This time it worked okay.

What is the .dat file?

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