ctimer Posted February 11, 2020 Posted February 11, 2020 I am trying to select a file by typing the file name I know the easier way is to use a single command to do it but i want to do it this way writing "question" into the body of the text file works fine but not into the "save as" box #include <GuiMenu.au3> #include <GuiComboBox.au3> _Main() Func _Main() Run("notepad.exe") WinWaitActive("[CLASS:Notepad]") $hWnd = WinGetHandle("[CLASS:Notepad]") $hMain = _GUICtrlMenu_GetMenu($hWnd) $t1 = _GUICtrlMenu_GetItemText($hMain, 0) $hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0) $t2 = _GUICtrlMenu_GetItemText($hFile, 3) Writeln("Question: ") ; here is the solution. It is language independent. WinMenuSelectItem($hWnd, "", $t1, $t2) sleep (2000) ControlGetHandle("Save as", "", "Class:edit; instance1") WinWaitActive("[CLASS:Notepad]") sleep (2000) ControlSend( $hWnd, "", "Edit1", "testing") EndFunc ;==>_Main
Moderators JLogan3o13 Posted February 11, 2020 Moderators Posted February 11, 2020 Is there a question here? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
ctimer Posted February 11, 2020 Author Posted February 11, 2020 so after i get into the "save as" box i want to enter "testing" string into the file open field box using ControlSend( $hWnd, "", "Edit1", "testing") which doesnt do anything,. any idea how to fix this?
Danp2 Posted February 11, 2020 Posted February 11, 2020 The variable $hWnd points to the main application window, not the Save As dialog. Fix this and your code will likely work. Latest Webdriver UDF Release Webdriver Wiki FAQs
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now