Script on Dropbox causes occasional access violation

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Krep
Junior Coder
Posts: 31
Joined: Thu Nov 12, 2009 3:56 pm

Script on Dropbox causes occasional access violation

Post by Krep » Thu Dec 31, 2020 9:38 pm

Hello,

First I want to say how much I love Macro Scheduler. I've been using it for many years and find it to be extremely useful and awesome!! After running an older version for better than 10 years I recently upgraded, and I'm surprised to say it was TOTALLY worth the money! Love the new features.

Anyway, I think I found something that might be an easy to fix bug:

Similar to this guy:
viewtopic.php?p=41966

I run the same script on several different machines, but I need to update it frequently. I "solved" this problem using Dropbox to hold the SCP file, and configured MS IDE to access files from my local dropbox folder. This works great except that occasionally Macro Scheduler reports an error message that it can't get to the file, I'm assuming because it tried at the same time as DropBox.exe...

Image

While you can click "Ok" this seems to send the MS IDE into a downward spiral which eventually leads to an access violation:

Image

More access violations follow, and eventually MS IDE starts behaving oddly, shows a blank page instead of the script, and the user cannot exit or do anything but force-close the MSschedule.exe (or whatever it's called).

Seems like what's needed is an error check in MS IDE, and then a few retries if the file is in use... most likely 1 or 2 cycles later the file would be freed up with no noticeable delay to the user. I'm surprised network shares wouldn't also be subject to this potential bug, but maybe since they don't have a local app (DropBox.exe) accessing the files it's a different story.

Would using a local copy (non dropbox) of the "main" macro, and then an "include" or "macro" statement to include the file, be a potential workaround?

Krep
Junior Coder
Posts: 31
Joined: Thu Nov 12, 2009 3:56 pm

Re: Script on Dropbox causes occasional access violation

Post by Krep » Fri Jan 01, 2021 5:31 pm

I should have said, the initial write conflict comes up when clicking the save icon.

-Krep

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

Re: Script on Dropbox causes occasional access violation

Post by PepsiHog » Sat Jan 02, 2021 1:10 am

Hi Krep,
My thought is it may be a timing issue. Such as maybe Dropbox isn't ready for input.(???) Maybe you need a delay at some point in your macro. I'm also wondering how you are going about putting the script into Dropbox. Is your macro trying to "writeln" it into Dropbox or do you write the script to your computer and then try to copy it to Dropbox? I think you may avoid issues if you just try copying it to Dropbox.(If that's not already the case.)

Maybe you have your heart set on this method, but another way,(and maybe easier) is to send it to email and grab it with email. Sign up for some small less used email system that lets you pop <something or another> your email.

If you look it up in MS, if you don't already, you'll see what I am refering to about pop.

If you wanted to put a file in DropBox how would you go about doing it? That's what your macro should also do.

Make your macro do everything that you would do. Allow for some delays. Keep in mind that a macro does things way, way quicker than any human can. So add some delays between each step. Even if it's just a second or two. Sometimes, for me, it helps to put larger delays at first and then watch it do it's thing. Once it works, you can start reducing your wait times.

Maybe, put each step in a srt. Get each sub-routine working in it's own right. Then call each sub-routine in order.

If you can/are willing to post your macro, I'd be willing to give it a once over.(Don't give me any personal info in the macro, of course.)

Good Luck,
PepsiHog

I looked up DropBox myself. Thought maybe I could get a free trial. Then help you with the macro. But I'd have to give them my debit card info. Nope.
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!

Krep
Junior Coder
Posts: 31
Joined: Thu Nov 12, 2009 3:56 pm

Re: Script on Dropbox causes occasional access violation

Post by Krep » Sat Jan 02, 2021 6:21 am

Hi PepsiHog,

Unfortunately this error is coming from the macro scheduler 15 IDE (Integrated Development Environment— does anyone call it that anymore? I.e. the script editor program) when simply pressing the save button. The script is not running at all when the error occurs. I don’t think it has anything to do with the script content, except that the .SCP file is stored in a locally cached Dropbox folder (as far as windows knows, this is just a file like any other file).

Actually I’ve been writing I/O data via macro scripts to various data files in local Dropbox folders for 10 years (screencapture BMPs, JPEGS, writeln, datestamp, log files, etc), continuously, 24/7 for weeks at a time, with never any access error, but this is the first I recall storing the script .SCP file itself in a Dropbox folder as well — admittedly most of that time was with an older version of macro scheduler (11?) and older Dropbox.

The problem appears to be an unhandled exception in the macro scheduler 15 editor code when it tries to execute a “save open .SCP file” function, while another local app is accessing the same file. While the first access conflict results in a meaningful message to the user (me), subsequent save attempts cause the macro scheduler 15 editor to experience an unhandled exception leading to a “memory leak” i.e. a pointer error... at least that is what it looks like to me, if someone can offer an alternate theory I’m all ears.

I can workaround the problem by shutting down Dropbox before saving the script in the macro scheduler editor, or moving the files to a different (non-Dropbox) folder but it’s more trouble as I switch back and forth between machines all day everyday, and run the scripts with the latest updates on both machines. Also the user output files I still need stored on Dropbox as I access them via my phone, so this means starting and stopping the drop box service constantly which is annoying.... hmmm I guess I could start / stop drop box in the script, mainly for the user files... that would be another workaround.

You shouldn’t need to provide anything but an email and create an account to get Dropbox. It’s a cloud based file sharing service with locally cached (they like to call sync’ed) files, like Google drive or Microsoft OneDrive, but without the baggage either of those come with. I’ve been using it for probably 10 years or more, and I haven’t yet needed any of the paid features.

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

Re: Script on Dropbox causes occasional access violation

Post by Grovkillen » Sat Jan 02, 2021 1:32 pm

I haven't read the whole conversation but wanted to add that this is happening because Dropbox is taking over the file when trying to sync. I think that it could be resolved by MS not needing to gain ownership of the file to write to the file.
Let>ME=%Script%

Running: 15.0.27
version history

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

Re: Script on Dropbox causes occasional access violation

Post by PepsiHog » Sun Jan 03, 2021 1:07 am

Go back to basics. If I want to save a file, I click a save icon. What commands in MS are you using to accomplish each task? That isn't a question for you to tell me. Reflect on the way you are going about doing each task. Break it down to basics. Get set up so you have the save button. Place an exit just before the part that clicks the save button(Actually run your macro up to the exit). Write a simple macro. MoveMouse and LeftClick. Run the macro. Do you get the same error/problem? If for no other reason, do this as a test.

And I can't stress the importance of having delays. If you don't get the same error, insert a delay. Do a stupid delay. Make it wait for 5 minutes before clicking the icon(using your original macro). I really believe stupid delays are a great problem solver.

If you can do it yourself, then so can Macro Scheduler. You just need to re-think it. Don't restrict yourself to one way of thinking or doing the task. Mix it up. Break dance on it's face! Treat your macro as though it's a child. Hold it's hand and drag that brat into the freak'n mud! That's what I do. All the time. I talk to my computer, like "Ok, let's see if you like this you stupid POS!" "Can you understand THAT you stupid....." You get the idea. And it at least makes me feel better.

Doing so, I bet you find the solution. Honestly, if you've been doing this for ten years, I'm probably preaching to the choir.

PepsiHog

[edit] - I tried again with dropbox. It's asking for card info. It's that sort of deal where it's free for 30 days, but if you don't cancel then they charge you for it. I don't trust that sort of deal.
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
Dorian (MJT support)
Automation Wizard
Posts: 1378
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Script on Dropbox causes occasional access violation

Post by Dorian (MJT support) » Mon Jan 04, 2021 9:39 am

Using Dropbox as a script storage location isn't something we can support. Some people have had a few odd things happen in the past. It can work, but sometimes/often it doesn't.

I think the issue is that if you change a file, Dropbox is going to try and sync it - upload it to the server. If Dropbox is doing something to it it may be locked and Macro Scheduler may not be able to access it and baulk. Vice versa. Worse could happen if you have the file on another machine and change it there and then it tries to sync back while Macro Scheduler has it open or when it tries to read it.

It may work, but it isn't recommended.

Maybe saving them locally and having a separate script which copies them to Dropbox might be a solution.
Yes, we have a Custom Scripting Service. Message me or go here

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

Re: Script on Dropbox causes occasional access violation

Post by Grovkillen » Mon Jan 04, 2021 10:06 am

Dorian, I can't really see what MS should need to have control over the file. I mean, save any text file and you will still be able to save if Dropbox is syncing. Even PDFs are possible to have online. The .scp are simply text files and shouldn't behave like this

Edit a .scp in Notepad++ and you'll see.
Let>ME=%Script%

Running: 15.0.27
version history

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

Re: Script on Dropbox causes occasional access violation

Post by Dorian (MJT support) » Mon Jan 04, 2021 10:12 am

Grovkillen wrote:
Mon Jan 04, 2021 10:06 am
Dorian, I can't really see what MS should need to have control over the file. I mean, save any text file and you will still be able to save if Dropbox is syncing. Even PDFs are possible to have online. The .scp are simply text files and shouldn't behave like this

Edit a .scp in Notepad++ and you'll see.
My response was based on the outcome of a long-running support ticket based on the same issue. It was based on the conclusion Marcus drew. We're not saying "it doesn't work", we're saying we can't support it and it isn't advised because it often doesn't.
Yes, we have a Custom Scripting Service. Message me or go here

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

Re: Script on Dropbox causes occasional access violation

Post by Grovkillen » Mon Jan 04, 2021 10:17 am

Dorian (MJT support) wrote:
Mon Jan 04, 2021 10:12 am
Grovkillen wrote:
Mon Jan 04, 2021 10:06 am
Dorian, I can't really see what MS should need to have control over the file. I mean, save any text file and you will still be able to save if Dropbox is syncing. Even PDFs are possible to have online. The .scp are simply text files and shouldn't behave like this

Edit a .scp in Notepad++ and you'll see.
My response was based on the outcome of a long-running support ticket based on the same issue. It was based on the conclusion Marcus drew. We're not saying "it doesn't work", we're saying we can't support it and it isn't advised because it often doesn't.
And I'd like to question that stance. Just disable the backup and it should work just fine. The way the backup is handled is to delete and rename files and should instead be over-write the backup files' contents. Dropbox will become angry if you try to delete a file but not if you only edit it.
Last edited by Grovkillen on Mon Jan 04, 2021 10:27 am, edited 1 time in total.
Let>ME=%Script%

Running: 15.0.27
version history

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

Re: Script on Dropbox causes occasional access violation

Post by Grovkillen » Mon Jan 04, 2021 10:23 am

By the way, the "backup option" is still checked in the menu even if I have turned the backup feature off.
Let>ME=%Script%

Running: 15.0.27
version history

Krep
Junior Coder
Posts: 31
Joined: Thu Nov 12, 2009 3:56 pm

Re: Script on Dropbox causes occasional access violation

Post by Krep » Mon Jan 04, 2021 3:08 pm

Grovkillen wrote:
Mon Jan 04, 2021 10:17 am
Just disable the backup and it should work just fine. The way the backup is handled is to delete and rename files and should instead be over-write the backup files' contents. Dropbox will become angry if you try to delete a file but not if you only edit it.
Aha! I think I'm getting a clue here... so the problem may not be the .SCP "save" over-write itself, but actually the process MS uses to save a backup (which includes a "delete"). I noticed when I look at the file history in Dropbox that MS deletes the oldest backup, renames oldestbackup-1 to oldestbackup, oldestbackup-2 to oldestbackup-1, etc.

Also, in related news, when manually deleting a file Dropbox will occasionally pop up a message "do you want to delete this file for all users?" (Which is a relatively new feature to Dropbox). But I've never seen that for a macroscheduler auto-delete (that I know of). Perhaps there is a Dropbox notification window being hidden by MS for some reason?

I'll try disabling backups and see if that works.

I still wonder if there is some unhandled exception in MS editor code that needs a handler... On file saves... but perhaps this is more complicated than that, due to the delete or another factor.

Krep
Junior Coder
Posts: 31
Joined: Thu Nov 12, 2009 3:56 pm

Re: Script on Dropbox causes occasional access violation

Post by Krep » Mon Jan 04, 2021 3:11 pm

Grovkillen wrote:
Mon Jan 04, 2021 10:23 am
By the way, the "backup option" is still checked in the menu even if I have turned the backup feature off.
Concur... I am not sure the feature to switch off backups actually works... the user cannot remove the checkmark in the pull down menu. (MS 15)

-Krep

Krep
Junior Coder
Posts: 31
Joined: Thu Nov 12, 2009 3:56 pm

Re: Script on Dropbox causes occasional access violation

Post by Krep » Mon Jan 04, 2021 3:14 pm

Edit: if you go to the "Backup Options", RE-check the box "Keep backups of scripts when you save them." and then click ok to save the change, then open it up again and UNcheck the same box and click Ok... THEN in the pull down menu the "Backup Options" item will have it's checkmark removed.

...But then if you exit macroscheduler and re-start it, the checkmark is back.

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

Re: Script on Dropbox causes occasional access violation

Post by Grovkillen » Mon Jan 04, 2021 3:23 pm

Yep, the delete part of the save is the culprit here. I think it's an easy fix. But like you I have disabled the backup feature since Dropbox is allowing me to have "version control". I've had Dropbox for many years and opted for the "pack rat" feature which allows for unlimited versions instead of the default 6 months. It has saved my rear more times than I want to admit.
Let>ME=%Script%

Running: 15.0.27
version history

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