Delete a cfg file and replace with a new one

(imported topic written by KimberlyNNH91)

Hi,

I’d like to delete C:\WINDOWS\system32\Macromed\Flash\mms.cfg and replace it with a new one. It seems so simple but I can’t get it to work.

thank you

(imported comment written by MarioJaeger)

I believe this will work, I have included both the relevance and the action scripts, you can expand on the relevance by using it with a combination of sha1 of the “old” file or checking if a certain value within is not updated.

In either case with the relevance below you will ONLY want to set it to run once and not reapply unless you apply one of the above solutions into it but since I do not know any specifics I cant help further then this.

NOTE:

What you should also do is add the relevance to check if the macromedia program you are using is installed on the computer first before deleting this file.

Relevance:

exists file (pathname of system folder & 
"\Macromed\Flash\mms.cfg")

Relevance comments:

  • Again use with caution as it does not do a check if the file even needs to be changed, ie already has new one.
  • In the success criteria you will need to select “…all lines of the action script have completed successfully” due to no checks of the file contents etc

Action script:

// Set directory parameters parameter 
"fileReplace" = 
"{pathname of system folder & "\Macromed\Flash\mms.cfg
"}" parameter 
"fileOld" = 
"{pathname of system folder & "\Macromed\Flash\mms.cfg.old
"}"   
// Backup existing file if needed later, also deletes any existing backup file 

if 
{exists file (parameter fileReplace)
} delete 
"{parameter "fileOld
"}" move 
"{parameter "fileReplace
"}" 
"{parameter "fileOld
"}" endif   
// Write the new .cfg file via text instead of importing it, its much quicker usually. 
// Insert complete text from the new .cfg file which you opened through notepad delete __createfile createfile until ___end___ ...paste here but delete 

this line ...paste here delete 

this line ... etc etc etc ___end___   move __createfile 
"{parameter "fileReplace
"}"

Regards,

Mario