2 Replies Latest reply: May 5, 2012 4:11 PM by jaxjason
s.i.m Level 1 Level 1 (0 points)

Hey guys,

I have a long script that alters numbers cells all the time, but when i want to test it, i need to keep command Z pressed for two minutes to eliminate all changes, to undo everything the script to test it again. How can I solve this? Is it possible to make a script that presses command Z for two minutes? or 150 times? Is there a way everything fast? 

  • Barry Level 7 Level 7 (29,215 points)

    I suspect there is, but haven't paid enough attention to AppleScripts that i've read to be able to say how to do it.

     

    Here's an alternative, though:

     

    Set your document up with the values you want to revert to, then before running the script, Save the document as a template.

     

    Test the script.

    If it needs adjustment, Close the document without saving and open a fresh copy of the document from the Template Chooser.

     

    Regards,

    Barry

  • jaxjason Level 4 Level 4 (3,520 points)

    My day job is writting automation for a certain desktop spreadsheet application used in most offices. We have to work on this test process all the time, all day long. Let me give you our test process...

     

    Create a folder to test in.

    Create a folder within that folder called "original docs".

    Copy all your original documents to this folder, and then copy then again to the main test folder.

     

    Run your test on the test folder contents, not the original docs files.

    After analyzing your results delete modified docs from the test folder

    Copy new fresh copies into the test folder form the original docs.

    Retest when ready

     

    If you require to track your tests. Make test scripts that state what steps your taking in the current test.

    Make the last sto of your script resave the document with a date and time stamp as part fmthenfile name, maybe even test script number.

     

    Jason