spoo Posted June 4, 2019 Share Posted June 4, 2019 Hello, How to send ALT+H+U+M using Control Send I can get it work using send ,however if my desired location is minimized then sends it to the current open application $excel_handle="Microsoft Excel - "&$fileName Local $hIE =WinGetHandle ($excel_handle) Local $hCtrl = ControlGetHandle($excel_handle, "", "") If WinExists($hIE,"") Then WinActivate($hIE,"") ControlSend($hIE ,"",$hCtrl,"{ALT}") ControlSend($hIE ,"",$hCtrl,"H",1 ) ControlSend($hIE ,"",$hCtrl,"M",1 ) ControlSend($hIE ,"",$hCtrl,"U",1 ) EndIf Link to comment Share on other sites More sharing options...
Exit Posted June 4, 2019 Share Posted June 4, 2019 (edited) $excel_handle="Microsoft Excel - "&$fileName Local $hIE =WinGetHandle ($excel_handle) Local $hCtrl = ControlGetHandle($excel_handle, "", "") If WinExists($hIE,"") Then WinActivate($hIE,"") ControlSend($hIE ,"",$hCtrl,"!H") ControlSend($hIE ,"",$hCtrl,"!M") ControlSend($hIE ,"",$hCtrl,"!U") EndIf or $excel_handle="Microsoft Excel - "&$fileName Local $hIE =WinGetHandle ($excel_handle) Local $hCtrl = ControlGetHandle($excel_handle, "", "") If WinExists($hIE,"") Then WinActivate($hIE,"") ControlSend($hIE ,"",$hCtrl,"{ALTDown}") ControlSend($hIE ,"",$hCtrl,"H",1 ) ControlSend($hIE ,"",$hCtrl,"M",1 ) ControlSend($hIE ,"",$hCtrl,"U",1 ) ControlSend($hIE ,"",$hCtrl,"{ALTUp}") EndIf Edited June 4, 2019 by Exit App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
spoo Posted June 7, 2019 Author Share Posted June 7, 2019 (edited) @Exit Thanks for the reply. Basically wanted to unmerge the cells in the excel for some reason iam not able to controlsend "M" and "u" , i used both your code.. i was able to press Home button but not Meger& center $oWorkBook.Activesheet.Range($A&$res+1&":"&$col_letter&$res+1).Select-->after selecting the column If WinExists($hIE,"") Then WinActivate($hIE,"") ControlSend($hIE ,"",$hCtrl,"{ALTDown}") ControlSend($hIE ,"",$hCtrl,"H",1 ) ControlSend($hIE ,"",$hCtrl,"M",1 ) ControlSend($hIE ,"",$hCtrl,"U",1 ) ControlSend($hIE ,"",$hCtrl,"{ALTUp}") EndIf works fine till home button press Thanks:) Edited June 7, 2019 by spoo Link to comment Share on other sites More sharing options...
Exit Posted June 7, 2019 Share Posted June 7, 2019 insert a sleep(1000) after sending "H" App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 7, 2019 Moderators Share Posted June 7, 2019 Or, you just choose your range and do it properly Ex: A1 and B1 Merged as a header: #include <Excel.au3> $oExcel = _Excel_Open() $oWorkbook = _Excel_BookOpen($oExcel, @DesktopDir & "\Merge.xlsx") With $oWorkbook.Worksheets("Sheet1").Range("A1") If .MergeCells Then .MergeArea.UnMerge EndIf EndWith "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! Link to comment Share on other sites More sharing options...
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