Macro Deleted

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

fightcancer
Macro Veteran
Posts: 249
Joined: Fri Apr 15, 2005 8:32 am

Macro Deleted

Post by fightcancer » Sat Mar 03, 2007 4:21 pm

I ran my 600-line macro yesterday afternoon, came back 20 min. later, and the macro had erred. When I went to edit the macro, it was completely empty. Also, the corresponding SCP is 0KB.

Has anyone else experienced this issue?

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

Post by JRL » Sat Mar 03, 2007 4:38 pm

Never heard of such a thing. Hope you have a backup.

Did you run the macro inside the editor? If inside the editor did you have any writelns ? I've had incorrectly formatted writeln functions (though I don't recall what I did wrong) that overwrote the next line in the script as I was pressing F8 in the editor.

Did the script perform any deleteFile> functions? Perhaps inadvertantly deleting itself.

What exactly is OKB?

Later,
Dcik

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

Post by Marcus Tettmar » Sat Mar 03, 2007 6:51 pm

Or perhaps the script sends keystrokes, and perhaps it failed to set focus to the correct window and those keystrokes landed on Macro Scheduler, causing just the right combination of events to delete the macro ...
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
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Mar 03, 2007 9:20 pm

Dick, I think the 0KB is zero kilobytes, empty!

Is is also possible that the script was run from the editor before being saved?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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

Post by JRL » Sun Mar 04, 2007 12:59 am

Bob wrote:I think the 0KB is zero kilobytes, empty!
Of course it is... :oops:

fightcancer
Macro Veteran
Posts: 249
Joined: Fri Apr 15, 2005 8:32 am

Post by fightcancer » Mon Mar 05, 2007 4:41 pm

Sounds like my experience was one in a million. Fortunately, I had a quasi backup so only had to edit a few lines.

FYI, yes the macro used the DeleteFile> command as well as an EditIniFile> command. However, there were no WriteLn commands--only ReadLn. Also, the macro sends keystrokes and uses the Press Del. So there are many possibilities.

IIRC, I was not running it with the editor open, but I could be mistaken. I'm just glad to know it won't likely happen again in my lifetime. :) Also, I'm in the process of converting the code from Wait> to WaitScreenImage> and FindImagePos>. So chances of a recurrence are slim.

Thanks for the feedback, Gents!

Methuselah
Junior Coder
Posts: 49
Joined: Fri Oct 15, 2004 8:42 am
Location: Johannesburg, South Africa

Not a once-off

Post by Methuselah » Wed May 30, 2007 6:43 am

Hi guys.

Glad I found this post - I am having similar, intermittent problem.
After a save, go back in to the macro and it's empty.
The first time it happens you think you are losing your mind.

MSched Standard, V9.1
Using inbuilt editor from MSched interface (i.e. not stand-alone edit)

Yesterday I was editing a new macro, one built at home.
Imported at client and was showing the client where to change some parameters. Save and run. Nothing. Go back into edit - empty.
That was two pairs of eyes that watched this happen.

I copied the code from the backup (fortunately not many changes).
Pasted into editor again, made the changes, saved.
Exit editor, click Edit again - empty.
Client laughed and walked away.

I tried this a number of times. Sometimes it would be fine, then sometimes not fine. At one point it was always wiping out the script - with the cursor on the last line (VBRUN>yada yada) and just as the status-bar syntax prompt was displayed, I clicked Save and then exit.
Sadly even that wasn't consistently broken.

I now do Ctrl-A, Ctrl-C before I save.
Then I exit and go back in to see if the script is still there.


Other clues :-
Only seems to affect imported or new macros.

Has nothing to do with WriteLn, Keystrokes or Delete commands.
Maybe VBScript ?? Macro posted below.

This is very hard to report to MJT, as it is not repeatable.

Please can I call for other folk to also report - maybe we can spot a pattern.


Robin.
//==================================================
//==
//== Email Management.
//==
//== Permanently delete items from Deleted Items folder.
//== Do so by NumberOfDays old
//==
//== V1.00 Robin Martin May '07
//==
//==================================================
VBSTART

Dim DaysToKeep
DaysToKeep = 5

Function EmptyDeletedItems()
Dim OL
Set OL = CreateObject("Outlook.Application")
Dim olItem
Dim fldJunk

Dim iCount
iCount = 0

Dim olFolderDeletedItems
olFolderDeletedItems = 3

Set fldJunk = OL.GetNamespace("MAPI").GetDefaultFolder(olFolderDeletedItems)
For Each olItem In fldJunk.Items
'== CreationTime can sometimes be empty.
'== Hard to replicate, however.
'== In that case, this macro will fail.
'== or prefer . . . olItem.LastModificationTime
'== That will be last-touched - Deleting changes this

If DateDiff("d",olItem.CreationTime,Now) > DaysToKeep Then
MsgBox olItem.Subject & " - Created " & olItem.CreationTime & vbCrLf & DateDiff("d",olItem.CreationTime,Now) & " days ago."
iCount = iCount + 1
'olItem.Delete
If iCount > 15 Then
Exit For
End If
End If

Next

Set olItem = Nothing
Set fldJunk = Nothing

Set OL = Nothing
End Function

VBEND
VBRUN>EmptyDeletedItems

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

Post by jpuziano » Wed May 30, 2007 8:03 pm

Hi Methuselah (Robin),

Sounds familiar, check out this forum post for more detail: Macros Not Saving

To test, I clicked the "New" toolbar icon, created and saved a new macro using your example code... and I was able to call it up after in the Advanced Editor. The code didn't disappear... but I agree... when it does happen, its quite a shock.

That said, it hasn't happen to me for a long time, at least a year or more ago, but just in case it ever should, I always keep the "Backup on Save" option on in the Advanced Editor. That way, I'm not at risk of loosing code.

The last time it happened to me, it was similar to what you've described. I was making changes to a macro, saving, exiting the Advanced Editor, running the macro to test, opening the macro for editing again in the Advanced Editor… over and over for at least an hour or so. During that time, the code disappeared 3 times out of maybe 50 cycles. It hasn't happened since that time though. I tried a few things but have never been able to reproduce this behavior... hard to troubleshoot what you can't reproduce.

If anyone has anything else to add, please jump in.
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 - :-)

Methuselah
Junior Coder
Posts: 49
Joined: Fri Oct 15, 2004 8:42 am
Location: Johannesburg, South Africa

Post by Methuselah » Wed May 30, 2007 8:25 pm

Hi jpuziano.
Backup on Save ??
(Okay I found it . . . not under Tools/Options as expected but hidden under Advanced Editor's Tools/Options ;-)
Excellent.
This will certainly help - beats Ctrl-A, Ctrl-C before every save :roll:

Methuselah
Junior Coder
Posts: 49
Joined: Fri Oct 15, 2004 8:42 am
Location: Johannesburg, South Africa

Still ongoing

Post by Methuselah » Thu Jul 19, 2007 6:19 pm

Hi guys - just an update to say this is still happening.
Having backups turned on is a real life saver, but . . . I still keep an Explorer window open to check the actual directory after every two or three saves.

I spotted another one today . . .
macroname.001 14 KB
macroname.002 0 KB <-- Problem came and then went away
macroname.003 14 KB
macroname.scp 14 KB


Is there ANY chance I can get hold of a "Debug Version" - one that checks the file sizes before and after a Save . . . I really would like to help track this intermittent bug down and kill it once and for all.

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

Re: Still ongoing

Post by jpuziano » Thu Jul 19, 2007 11:18 pm

Hi Methuselah,
Methuselah wrote:Is there ANY chance I can get hold of a "Debug Version" - one that checks the file sizes before and after a Save . . . I really would like to help track this intermittent bug down and kill it once and for all.
I hear ya... this happened again to me last week, one occurance only.

I'm fairly certain it happens when doing a save but I've never been able to reproduce it on demand.

The total unpredictability of this makes me suspect some sort of race condition. Perhaps if the PC is very busy with disk activity for another application at the moment we save a script... or memory is running low... or "mysterious condition X" occurs, it causes the save of the script to fail. Does anyone know if this is likely or even possible?

1) Maybe a "watcher" macro could be written that could run in the background and watch to see if any new files are created in the directory where scripts are saved. When it detects a new file has been created, it could use the FileSize> command to test to see if its 0 bytes and if so, immediately alert the user. Anyone have a macro like this?

2) Good idea Methuselah. If a "debug" version of Macro Scheduler were created, extra code could be added to the Save function itself so that immediately after a Save, it would check the actual size of the file it just saved and if it came up with 0 bytes, it could immediately warn the user and/or retry the save one or more times until it validates that a non-zero byte file has actually been written... as well as save everything to a debug log file.

Marcus if you do produce a debug version, I'd be happy to run that for a good long while and send you any logs collected if it happens again.

Take care all
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 - :-)

thaumaturgy
Junior Coder
Posts: 24
Joined: Mon Nov 01, 2004 1:30 pm

Post by thaumaturgy » Fri Jul 20, 2007 12:19 pm

I got in the habit of waiting a couple extra secounds before saving " any " file a long time ago. That's not a macro scheduler problem. It can happen when saving any file. Specially with older computers. Ever Since I started waiting those extra seconds I've never had that problem occur again.

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

Post by jpuziano » Fri Jul 20, 2007 7:31 pm

thaumaturgy wrote:I got in the habit of waiting a couple extra secounds before saving " any " file a long time ago. That's not a macro scheduler problem. It can happen when saving any file. Specially with older computers. Ever Since I started waiting those extra seconds I've never had that problem occur again.
Hi thaumaturgy,

Interesting, if that's true, then I would recommend that some extra code be added to Macro Scheduler so that after Saving a script, it always checks the size of the file it just saved and if it ever finds that a file it just saved is 0 bytes, it could wait a second then try again, say to a maximum of five times. If after that it still can only produce a 0 byte file, perhaps the drive is full or there is some other problem so the user could receive a warning msg, "File Save Error" or "File Save Error - Disk Full" if the disk was indeed full.

That might be all it takes to ensure there are no more 0 byte file saves. What do you think Marcus?
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 - :-)

Methuselah
Junior Coder
Posts: 49
Joined: Fri Oct 15, 2004 8:42 am
Location: Johannesburg, South Africa

Post by Methuselah » Wed Jul 25, 2007 8:07 pm

The best workaround may simply be to use a different editor.
One that you can trust.

BTW. Had anyone ever reported this problem using stand-alone edit ?
i.e. does the problem only happen when using the main interface.

fightcancer
Macro Veteran
Posts: 249
Joined: Fri Apr 15, 2005 8:32 am

Post by fightcancer » Thu Aug 23, 2007 9:00 am

I just had this problem again 11 minutes ago. Last edit per MS was 8/23/2007 4:46 AM. Now the macro and its 1,743 lines of code are gone. The SCP is 0 KB. :(

Fortunately the backup is less than 12 hours old.

(I use the MS editor only.)
Last edited by fightcancer on Thu Aug 23, 2007 9:16 am, edited 5 times in total.

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