Ask a Question

SaveFile Overwrite

jvezzoli
New Contributor

SaveFile Overwrite

Is there an easy way to overwrite an existing file?  When saving a file, the confirmation window to overwrite the existing file has the same properties as the Save As window.
3 REPLIES 3
AlexanderM
Staff

RE: SaveFile Overwrite

Hi Jake,




Try identifying the dialog windows by specifying the child objects required for the recognition of the dialog windows (e.g. the 'Yes' button for the confirmation dialog and the 'Save' button for the 'Save As' dialog). To learn how to accomplish this, see the 'Specifying Child Objects Required for Mapped Object Identification' help topic.




Does this work for you?

-----

Alexander
Customer Care Manager
jvezzoli
New Contributor

RE: SaveFile Overwrite

I tried that, and it worked in XP, but when running in Vista or 7 it would still fail to find the Yes button.  It turned out that this was due to the behind the scene difference of the Save dialogs between XP and the other OSs.  I found a solution by using the new SaveFile method and then using the FindChild method from the Save dialog's parent to find the Yes button.
AlexanderM
Staff

RE: SaveFile Overwrite

Hi Jake,




Also, in addition to the Required Children feature, you can try using the following approach:




1. Map the needed objects under Windows XP (the 'Yes' button will be mapped as a child of the 'Save As' dialog).




2. Enable the 'Extended Find' option for the mapped 'Yes' button. After the option is enabled, TestComplete will be searching for it within all descendant objects of the button's parent object (which is the mapped 'Save As' dialog). This should avoid recognition problems caused by the difference between the 'Save As' dialog's object hierarchy in Windows XP and Windows 7 or Vista. To learn more about the 'Extended Find' option, see the 'Name Mapping Editor' help topic.




3. The value of the confirmation dialog's WndCaption property is equal to 'Confirm Save As' in Windows 7 and Vista, while the same property's value is equal to 'Save As' in Windows XP. So, you need to remove this property from the confirmation dialog's mapping criteria.




4. Remove the Index property from the mapping criteria of both dialogs. The property value equals 1 only for the last dialog window to appear. So, in your case, after the confirmation dialog appears, the value of the 'Save As' dialog's Index property changes from 1 to 2.

-----

Alexander
Customer Care Manager
cancel
Showing results for 
Search instead for 
Did you mean: