Jump to content
VeryGut

Accessing an excel pop-up window with controlclick

Recommended Posts

VeryGut

I am unable to access an annyoing pop-up window an press the "No" button. So far I have tried a combination (including using coordinates etc.) of the following:
ControlClick("[TITLE: Worksite; CLASS: #32770]", "&No", "[CLASS: Button2]")

Doesnt seem to be working :C

>>>> Window <<<<
Title:  WorkSite
Class:  #32770
Position:   786, 471
Size:   356, 162
Style:  0x94C801C5
ExStyle:    0x00010101
Handle: 0x00000000000209E2

>>>> Control <<<<
Class:  Button
Instance:   2
ClassnameNN:    Button2
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:2]
ID: 7
Text:   &No
Position:   158, 96
Size:   88, 26
ControlClick Coords:    40, 11
Style:  0x50010000
ExStyle:    0x00000004
Handle: 0x000000000004075E

>>>> Mouse <<<<
Position:   987, 604
Cursor ID:  0
Color:  0x3687CE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
&Yes
&No
Cancel
Do you want to save the changes you made to 'TEST.xls'?


>>>> Hidden Text <<<<

Share this post


Link to post
Share on other sites
water

What causes this message to pop up? A script or a user :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
VeryGut
4 hours ago, water said:

What causes this message to pop up? A script or a user :)

This particular line of code in my script:
_Excel_BookClose($oWorkbook, False)

Which is weird considering that the 2nd parameter was set fo False and it should not try to save the document.

 

Edited by VeryGut

Share this post


Link to post
Share on other sites
water

Can you please post the _Excel_Open line of your script?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
VeryGut
1 minute ago, water said:

Can you please post the _Excel_Open line of your script?

$oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook, True)

I have set it to Read only mode

Share this post


Link to post
Share on other sites
water

No, I mean _Excel_Open to startup Excel itself.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
VeryGut
Just now, water said:

No, I mean _Excel_Open to startup Excel itself.

$oExcel = _Excel_Open()

Share this post


Link to post
Share on other sites
anthonyjr2

What happens if you call

_Excel_Close($oExcel, False)

Instead of your _Excel_BookClose line? This will close the entire instance of excel without saving so it could maybe stifle the popup. I had the exact same problem as you a while ago but I can't for the life of me remember what I did to solve it.


UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites
VeryGut
13 minutes ago, anthonyjr2 said:

What happens if you call

_Excel_Close($oExcel, False)

Instead of your _Excel_BookClose line? This will close the entire instance of excel without saving so it could maybe stifle the popup. I had the exact same problem as you a while ago but I can't for the life of me remember what I did to solve it.

I tought about this method, but it doesnt work aswell. I think it would be the easiest to simply press that button, but i got no clue how. As Im quite new to the whole scripting thing, i was wondering if it has anything to do with child windows. Can it be the cause? Do I need to somehow tell the script that the window is a child and not the main window of excel?

Share this post


Link to post
Share on other sites
water

As you open the workbook read-only, what does your script change in the workbook so that Excel thinks it needs to be saved?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
VeryGut
Just now, water said:

As you open the workbook read-only, what does your script change in the workbook so that Excel thinks it needs to be saved?

I use the function to transfer some data from one workbook to another.

_Excel_RangeCopyPaste

Share this post


Link to post
Share on other sites
water

Which version of Excel do you run?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
VeryGut
1 minute ago, water said:

Which version of Excel do you run?

2013

Share this post


Link to post
Share on other sites
water

If this is the full code you run then I do not see any reason why the source workbooks hould need to be saved:

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
anthonyjr2
9 minutes ago, junkew said:

you should put $oExcel.DisplayAlerts=False in your coding

That should be on by default when he calls _Excel_Open()


UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites
junkew
#include <Excel.au3>
#include <MsgBoxConstants.au3>

; *****************************************************************************
; Force the creation of a new Excel application and display alerts
; *****************************************************************************
local $oExcel = _Excel_Open(Default, Default, Default, Default, True)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Open Example 2", "Error creating a new Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $aProcesses = ProcessList("Excel.exe")
If $aProcesses[0][0] = 1 Then
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Open Example 2", "Excel Application has been opened successfully." & @CRLF & @CRLF & $aProcesses[0][0] & " Excel instance is running.")
Else
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Open Example 2", "Excel Application has been opened successfully." & @CRLF & @CRLF & $aProcesses[0][0] & " Excel instances are running.")
EndIf

consolewrite($oExcel.Displayalerts)
_Excel_Close($oExcel)

See if above gives a popup (only opens/closes excel)

 

Share this post


Link to post
Share on other sites
VeryGut

I solved my problem by adding _Excel_BookSave before closing the book. This takes care of any problems you might encounter with custom addons that modify how excel saves files etc.

Share this post


Link to post
Share on other sites
water

Those #§$%& addons :x


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
VeryGut

By the way, for some reason _Excel_BookSave saves my files on the desktop, instead of oversaving the file in the script directory. How do I avoid this? I have tried _Excel_BookSaveAs($Files[$i], @ScriptDir & $Files[$i], True) but it doesnt seem to work as it saves to desktop aswell. Do I have to save it to @TempDir or sth?

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

  • Similar Content

    • Tats
      By Tats
      Hi everyone,
      I have a problem with ControlClick function. It doesn't work no matter how I tried all the possible combination of the parameters.
      Below is the scripts of possible parameter combination:
      ;ControlClick("title","text","controlID ","button","clicks","x","y") ;title= Title, Class, Handle ;controlID= Class, ClassNN, Instance ;Title here is empty when I check it with AutoIt Info ControlClick("", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Class of the window ControlClick("[ScreenKeyboard::SKFrame]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[ScreenKeyboard::SKFrame]", "", "[INSTANCE:18]", "left", "1", "230","890") ;Title here is the Handle of the window ControlClick("[0x000907A0]", "", "[ScreenKeyboard::Button18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[CLASS:ScreenKeyboard::Button; INSTANCE:18]", "left", "1", "230","890") ControlClick("[0x000907A0]", "", "[INSTANCE:18]", "left", "1", "230","890") Am I coding it correctly?
      Thanks
    • MaximusCZ
      By MaximusCZ
      Hello, and apologies if this have been discussed before, but I googled and couldnt find anything relevant.
      I have a problem where I try to send a control clink into to a window. 
      Part of window I try to send clicks to looks like this . The black border is showing when I mouse over it Au3Info, I get following information:

      I am testing its interaction with code

      The result I get is that it makes control clicks trough first line, opens and closes menus, as expected.
      When It gets to second line, it does not click a single icon. I can tell that coords are correct as the dropdown menus (No view active) gets focused(altough not rolled out). Same behaviour happens if roughly 40<y<60, so I know I am hitting good height. You can look at how it behaves here: output.webm 
      Dropdown 1 focuses at around 8 sec mark, and 13 sec mark it changes to second dropdown, defocusing first one, seemingly not registering any clinks inbetween.
       
      Have you ever encountered similar behaviour? I need to click the Key button, first on second line, with controlclick (or any other way not hijacking the mouse). I cant trigger that button by keyboard and There is no other control having control over it.
      Help
       
    • Skysnake
      By Skysnake
      I need to automate a specific GUI from a legacy system written in C.
      The spy tool gives me this

      I use this code
      Local $swintit = WinGetTitle("[active]") ConsoleWrite("active Window " & $swintit & @CRLF) If $swintit = "FILES NOTES" Then ; If $swintit = "FILES NOTES" Then ; got Window, now atomate ConsoleWrite("got Window " & @CRLF) ; now focus, then click :) ;EditPaste ;ControlCommand("FILES NOTES", "", 404, $acno) ; paste acno GUICtrlSetState(404, $GUI_Focus) ControlCommand("FILES NOTES", "", 404, $acno) ; paste acno GUICtrlSetState(401, $GUI_Focus) ControlClick("FILES NOTES", "", 401, $acno) ; click okay EndIf ; If $swintit = "FILES NOTES" Then The idea is to paste the acno value into the edit box, then click an Okay button.
      I get a console write that the active Window is as expected, but my loop completes without ever writing anything into the GUI.
      I also tried the control ID as text "404" - same result
      What am I missing?
      Skysnake
       
    • JNutt
      By JNutt
       

       
       
      I'm trying to use mouseclick in a panel above.  I want to click on a list item, such as 'Estimated'.  (I've given up on trying to use control click for this).  I'm using window info coordinates from 'Control' tab.

      ; click 'Columns' WinActivate("Innovaya Studio with Sage (Archtectural 2017_V1.invx") MouseClick("primary", 292, 88, 1, 1) WinActivate("Select Browsing Properties") Sleep(1000) MouseClick("primary", 27, 70, 0,0) Sleep(2000) Send("{TAB}{TAB}{TAB}{TAB}{TAB}") Sleep(1000) Send("{ENTER}") ControlClick( But when I used the code Autoit doesn't click where the coordinates are.  In the scipts it is the second MouseClick that won't work.  Any ideas?
    • Miliardsto
      By Miliardsto
      Hello I got this script works below and I want to do not move cursor on screen when action is performed.
      Opt("MouseCoordMode", 1) ; cause it gets whole screen coords Local $x, $y Local $search = _ImageSearch('item.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y,0) MouseClick("right", $x, $y)) MouseMove($xMiddle, $yMiddle,0) MouseClick("left", $xMiddle, $yMiddle) EndIf I changed this above to this below and what happen is. It clicks right button and then left button but not move mouse to $x $y and then to $xMiddle $yMiddle.
      Opt("MouseCoordMode", 1) ; cause it gets whole screen coords Local $x, $y Local $search = _ImageSearch('item.bmp', 0, $x, $y, 0) If $search = 1 Then ControlClick("","",0,"secondary",1,$x,$y) ControlClick("","",0,"primary",1,$xMiddle,$yMiddle) EndIf If needed I got handle in var $hwnd
      Please tell me how parameters in ControlClick would like be
×