Jump to content

Recommended Posts

Posted

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 <<<<
Posted

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)
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
Posted

Can you please post the _Excel_Open line of your script?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
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

Posted

No, I mean _Excel_Open to startup Excel itself.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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=

Posted
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?

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
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

Posted

Which version of Excel do you run?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
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=

Posted
#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)

 

Posted

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.

Posted

Those #§$%& addons :x

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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?

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
×
×
  • Create New...