I am using the following code to find a Save As dialog and enter the name of the file to save in the File Name field.
Code: Select all
Ranorex.Form HDReportSaveAsForm;
HDReportSaveAsForm = WaitForWindow("Save As", 30);
HDReportSaveAsForm.EnsureVisible();
Keyboard.Press("{Alt down}n{Alt up}");
Keyboard.Press("foo");
I have also tried the follwoing with the same results:
Code: Select all
Keyboard.Down(Keys.LMenu);
Keyboard.Press("n");
Keyboard.Up(Keys.LMenu);
The issue is that the text that is entered in the File Name field is always missing the first character (I.e. in my example above the text entered is "oo" instead of "foo"). It appears that the {Alt up} is not actually release the alt key as expected. If my text to exter has a space as the first character it opens the Save As dialog's Move menu as you would get from Alt-SPACE.
NOTE: WaitForWindow is just my own method for waiting for a window to appear and returning the Ranorex.Form object
Code: Select all
Host.Local.FindChild<Ranorex.Form>(WindowName);
Alt-n should verify that the cursor is in the File Name text filed since N is the hotkey.
You can verify this issue using the Notepad Save As dialog. (I.e. start Notepad and select File -> Save As)
This is using v2.0.2.