Macro Deleted

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

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

Post by Marcus Tettmar » Thu Aug 23, 2007 9:04 am

Have been watching this topic with interest and concern. Have never seen this myself, and have tried to replicate to no avail.

Therefore very keen to find out what causes it and put a stop to it. Please let me know if you identify any pattern.

In the mean time make sure you're keeping backups!
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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

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

Just found the "Backup on Save" option and will use it regularly. Thanks for the interest and concern!

I should mention that I use the keystroke CTRL + SHIFT + X to invoke this particular macro.

Also, I use the key combo ALT + SPACE, C to close the MS editor. (Then I press ENTER if the "Do you wish to save changes" dialogue appears.)

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

Post by Methuselah » Thu Aug 23, 2007 10:01 am

This sort of thing is a real swine to catch. In terms of patterns, here's some things I've noticed, perhaps we can add to it, confirming or refuting these :-

1. It only seems to happen when doing repeated editing-and-testing, i.e. make a small change, run the macro, go back in to make a change, save, and run again.

2. It seems to happen more frequently when you are working quickly, save, exit, play, edit, change, save, play etc.
(Could it be related to multiple Save requests, click save, pause, think did_i_save?, so click save again ?)

3. It doesn't seem to affect short macros - I've only had drama with the longer scripts. ( Subjective - most of my macros are long ones ;-)

4. I cannot recall it ever happening when calling the editor in stand-alone mode.

5. I cannot recall if it ever happens when you have NOT run the macro in debug mode that session (play with code open in editor or F8 step through)


When using the MSched interface, after a save, I alt-tab to Explorer and check the .SCP file size before I exit. Painful, yes, I know, but at least gives peace-of-mind.

What I do mostly now is to use the editor from Explorer, not MSched. After save and exit, it's a double-click to run the macro. With Backup on, there's also the visual check before you run so can see if there's trouble.

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

Post by fightcancer » Thu Aug 23, 2007 10:51 am

I can confirm 1-3. In 4, what is "stand-alone" mode please? I don't recall about 5 either, but this issue has only happened twice (ever) with me.

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

Post by Methuselah » Thu Aug 23, 2007 11:35 am

Thanks for the replies ;-)

Stand-alone mode is when you access the .SCP file directly from Windows Explorer - right-click and select Edit. This still calls the MSched editor, but not from the normal scheduler interface.

Also, I don't use keystrokes to invoke or save, so I don't think the trouble lies in that direction.

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Thu Aug 23, 2007 11:44 am

Hi fightcancer and Methuselah,

Here is a script I posted last year that will backup all your scp files in the macro scheduler directory everytime the macros.dat is updated. Only thing you have to edit is the Macro Scheduler directory (line 2), backup location (line 3) and the macros.dat location in line 4. I have some scripts that are over 7000 lines long so I know how you two must feel. I hope this helps.

Original discussion http://www.mjtnet.com/forum/viewtopic.p ... highlight=

Here is the script with a Dialog.

Code: Select all

let>APP_TITLE=Automated Script Backup
let>MJT_Net_Folder_Location=C:\Program Files\Macro Scheduler
let>Backup_Folder_Location=C:\Backup Scripts
Let>Macros_Dat_File_Location=C:\Program Files\Macro Scheduler\macros.dat
cre>%Backup_Folder_Location%
vbstart
Function filetime (filespec)
  Dim fso, f, s
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f = fso.GetFile(filespec)
  s = f.DateLastModified
  s = FormatDateTime(s,vbLongTime)
  filetime = s
End Function
vbend
Dialog>Dialog1
   Caption=Script Backup
   Width=155
   Height=95
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=1
   Resize=0
   Label= ,24,32,true
   Button=Open Backup Folder,8,0,129,25,1
EndDialog>Dialog1

show>Dialog1
label>start
rda>Dialog1
vbeval>filetime("%Macros_Dat_File_Location%"),time_a
fdt>%Macros_Dat_File_Location%,date_a
let>check_a=%time_a%%date_a%
label>loop
wai>0.005
gda>Dialog1,result
if>result=1,open folder
if>result=2,2
VBEval>filetime("%Macros_Dat_File_Location%"),time_b
fdt>%Macros_Dat_File_Location%,date_b
let>check_b=%time_b%%date_b%
if>check_b<>check_a,backup
goto>loop
label>backup
gfl>%MJT_Net_Folder_Location%\*.scp,files
sep>files,;,file_names
gtm>btime
let>Dialog1.msLabel0=%file_names_count% Scripts backed up at%crlf%%btime%
rda>Dialog1
let>file_counter=0
day>day
month>month
year>year
sec>seconds
min>minutes
hour>hour
let>folder_name=Backup %day%-%month%-%year% %hour%-%minutes%-%seconds%
cre>%Backup_Folder_Location%\%folder_name%
repeat>file_counter
Let>file_counter=file_counter+1
cop>file_names_%file_counter%,%Backup_Folder_Location%\%folder_name%\
until>file_counter,file_names_count
goto>start
label>open folder
exe>%Backup_Folder_Location%
goto>start
label>2


Here is the same script without a Dialog

Code: Select all

let>APP_TITLE=Automated Script Backup
let>MJT_Net_Folder_Location=C:\Program Files\Macro Scheduler
let>Backup_Folder_Location=C:\Backup Scripts
Let>Macros_Dat_File_Location=C:\Program Files\Macro Scheduler\macros.dat
cre>%Backup_Folder_Location%
vbstart
Function filetime (filespec)
  Dim fso, f, s
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f = fso.GetFile(filespec)
  s = f.DateLastModified
  s = FormatDateTime(s,vbLongTime)
  filetime = s
End Function
vbend
label>start
vbeval>filetime("%Macros_Dat_File_Location%"),time_a
fdt>%Macros_Dat_File_Location%,date_a
let>check_a=%time_a%%date_a%
label>loop
wai>0.005
VBEval>filetime("%Macros_Dat_File_Location%"),time_b
fdt>%Macros_Dat_File_Location%,date_b
let>check_b=%time_b%%date_b%
if>check_b<>check_a,backup
goto>loop
label>backup
gfl>%MJT_Net_Folder_Location%\*.scp,files
sep>files,;,file_names
let>file_counter=0
day>day
month>month
year>year
sec>seconds
min>minutes
hour>hour
let>folder_name=Backup %day%-%month%-%year% %hour%-%minutes%-%seconds%
cre>%Backup_Folder_Location%\%folder_name%
repeat>file_counter
Let>file_counter=file_counter+1
cop>file_names_%file_counter%,%Backup_Folder_Location%\%folder_name%\
until>file_counter,file_names_count
goto>start
Last edited by Rain on Thu Aug 23, 2007 12:40 pm, edited 2 times in total.

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Thu Aug 23, 2007 12:13 pm

I had to disable HTML to display my scripts correctly :?
Both of them should work now.

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

Post by fightcancer » Sat Aug 25, 2007 12:01 pm

Thanks Rain.

It just occurred to me that I occasionally copy my scripts to MS Word so I can do a find and replace to substitute all tabs for 4 spaces. I wonder if the MS Word formatting has anything to do with it.

Methuselah, I usually edit in MS by highlighting the macro and pressing Ctrl+S. I'm not sure how you classify that form of editing.

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

Post by Methuselah » Sat Aug 25, 2007 8:21 pm

fightcancer wrote:occasionally copy to MS Word . . . substitute all tabs for 4 spaces.
It's not restricted to that, but I did have my worst time after importing macros I created externally - in another editor.
fightcancer wrote:highlighting the macro and pressing Ctrl+S.
That's definitely from the main Msched interface.
Standalone mode is when you use Windows Explorer to navigate to the folder where the actual .SCP files reside. If you right-click on a macro, you can select item "Edit" from the context menu.

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