Ask a Question

Simulating keypress Alt+o not working

shiva_ranabhat
Contributor

Simulating keypress Alt+o not working

According to this article: https://support.smartbear.com/viewarticle/55009/ [Alto] should simulate Alt+O.

 

Please correct me! 

Jscript language:

 

Sys.Desktop.Keys("[Alto]");

or

Sys.Desktop.Keys("[Hold][Alto]");

 

Neither of them works. I want to open the download by pressing Alt and O. 

 

Thanks

 

 

7 REPLIES 7
Marsha_R
Community Hero

Going by that page, I believe what you want is 

 

Sys.Desktop.Keys("~[O]");


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

No that doesn't work. I think it is pressing Alt and O separately because I can see the toolbar in IE.

Then next I would try

 

Sys.Desktop.Keys("[Hold}~[O]");


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

Man Sad

I have tried every single combination there.Then went frustrated and post it in the community.

 

It is pressing Alt as you can see underline under Open.

 

exportopen.jpg

 

Thanks anyway!

try:

 

llplayer.keydown win32api.vk_lmenu,100

sys.desktop.keys "o"

llplayer.keyup win32api.vk_lmenu,100

 

Hi Shiva,

 

Please try this => Sys.Desktop.Keys("[Hold]~o");

 

Instead of 

 

Sys.Desktop.Keys("[Hold]~[O]"); Here you are using o with in Braces[]. The string only comes with in double quotes. I am not sure but please try above solution. If it work then it will fine

 

Thanks,

Kamal

Hi,

 

The following code worked for me (to Save|Save As):

'-------------------------------------------------------------------------
Function SystemDialogFileSaveHandle(ByVal strFileFullName)
  Const cProcName = "SystemDialogFileSaveHandle"
  Dim cProcNameMsgPrefix : cProcNameMsgPrefix = cUnitNameMsgPrefix & cProcName & "(): "
  Dim browser
  Dim UploadFileWindow
  Dim button, button2
  Dim tmpControl
  Dim FileName, FullFileName
  SystemDialogFileSaveHandle = Empty
  ' handle notification bar window
  ' For cross-browser specifics:
  ' http://support.smartbear.com/articles/testcomplete/cross-browser-testing/
  ' http://smartbear.com/forums/f75/t76579/click-on-short-time-pop-window-(e-g-ie9-noti/
  ' http://smartbear.com/forums/f75/t60772/ie-8-file-download-box-save-button-not-gettin/
  ' http://smartbear.com/forums/f75/t60730/ie-8-save-button-is-visible-on-screen-but-vi/
  Set browser = Aliases.browser
  Select Case browser.ObjectIdentifier
    Case "iexplore"
      Select Case browser.FileVersionInfo.MajorPart
        Case 7
        Case 8
        Case Else
          Set UploadFileWindow = BrowserWindowByPageGet(GetPage()).FindChild("ObjectIdentifier", "Notification*", 30)
' Aliases.browser.BrowserWindow(0).Window("Frame Notification Bar", "", 1).ToolBar("Notification").Text("Notification bar Text").Value
          Set button = UploadFileWindow.FindChild( _
              Array("ObjectType", "ObjectIdentifier"), Array("SplitButton", "Save"), 30)
          Set button2 = button.FindChild("ObjectType", "DropDownButton", 30)
          button2.Click
          browser.Popup("Context").MenuItem("Save as").Click
      End Select
    Case "firefox"
      Set UploadFileWindow = browser.WaitAliasChild("MozillaDialog", 30000)
      Set button = UploadFileWindow.FindChild( _
          Array("ObjectType", "ObjectIdentifier"), Array("radio", "save"), 30)
      button.Click
      Set button = UploadFileWindow.FindChild( _
          Array("ObjectType", "ObjectIdentifier"), Array("button", "OK"), 30)
      Call button.WaitProperty("Enabled", True, Project.Variables.pvtPageTimeout)
      button.Click
    Case "chrome"
      Set UploadFileWindow = browser.FindChild("WndClass", "#32770", 30)
  End Select ' browser.ObjectIdentifier
  FullFileName = ...
  Call SystemDialogFileSave(FullFileName)
  SystemDialogFileSaveHandle = FullFileName
End Function
'-------------------------------------------------------------------------
 
' Returns BrowserWindow object that corresponds to the given page object
' From: http://smartbear.com/forums/f75/t83264/how-to-match-a-page-object-to-its-browserwindow
Function BrowserWindowByPageGet(ByRef page)
  Const cProcName = "BrowserWindowByPageGet"
  Dim cProcNameMsgPrefix : cProcNameMsgPrefix = cUnitNameMsgPrefix & cProcName & "(): "
 
  Dim title
  Dim wnd
 
  Set wnd = Utils.CreateStubObject
  If (Not IsNull(page)) Then
    If (0 = aqString.Compare(page.ObjectType, "Page", False)) Then
      title = page.contentDocument.title
      Set wnd = page.Parent.FindChild("WndCaption", title & "*")
      If (Not wnd.Exists) Then
        Set wnd = page.Parent.FindChild("WndCaption", Project.Variables.pvtBaseURL)
      End If
    End If
  End If
  Set BrowserWindowByPageGet = wnd
End Function
'-------------------------------------------------------------------------

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
cancel
Showing results for 
Search instead for 
Did you mean: