Jump to content
Sign in to follow this  
spoo

Control send

Recommended Posts

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

 

Share this post


Link to post
Share on other sites
$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 by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Share this post


Link to post
Share on other sites

@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 by spoo

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...