System events with OpenOffice - not working after update 4.1.1

Hi,

I have a script to open csv file with OpenOffice and save them as xls files. Working OK for years.
Since last OpenOffice update (I guess this is the culprit ?), something is wrong !

The script manages to find “window 1” (it logs end repeat1") but pop up button 1 never seems to exist (the loop keeps giving “false”).

The window in OpenOffice is the window that pops up when trying to open a csv file (you can choose character set, language…)

Any idea ?

Thanks
Best regards,
Nicolas

tell application "OpenOffice" to activate
tell application "System Events"
	tell application process "OpenOffice"
		repeat until window 1 exists -- permet d'attendre que l'application soit ouverte
		end repeat
		log "end repeat1"
		
		tell window 1
			
			
			
			repeat until pop up button 1 exists
			end repeat
			log "end repeat3"
			
			
			tell pop up button 1
				log "pop up button 1"
				click
				keystroke "gr"
				--repeat 4 times : commande modifiée le 13 juillet 2012
				repeat 6 times
					key code 126 -- flèche vers le haut
				end repeat
			end tell
		end tell
	end tell
end tell

Hello

Here is what I get on my French system :

tell application "OpenOffice" to activate
tell application "System Events" to tell process "OpenOffice"
	repeat until exists window 1
		delay 0.1
	end repeat
	tell window 1
		properties of UI elements
		(*
		{{minimum value:missing value, orientation:missing value, position:{198, 108}, class:button, role description:"Bouton de fermeture", accessibility description:missing value, focused:false, title:missing value, size:{14, 16}, value:missing value, help:missing value, enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:"AXCloseButton", selected:missing value, name:missing value, description:"Bouton de fermeture"}, 
		{minimum value:missing value, orientation:missing value, position:{238, 108}, class:button, role description:"Bouton de réduction ou d'agrandissement", accessibility description:missing value, focused:false, title:missing value, size:{14, 16}, value:missing value, help:missing value, enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:"AXZoomButton", selected:missing value, name:missing value, description:"Bouton de réduction ou d'agrandissement"}, 
		{minimum value:missing value, orientation:missing value, position:{218, 108}, class:button, role description:"Bouton de placement dans le Dock", accessibility description:missing value, focused:false, title:missing value, size:{14, 16}, value:missing value, help:missing value, enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:"AXMinimizeButton", selected:missing value, name:missing value, description:"Bouton de placement dans le Dock"}, 
		{minimum value:missing value, orientation:missing value, position:{1704, 108}, class:button, role description:"bouton plein écran", accessibility description:missing value, focused:false, title:missing value, size:{16, 17}, value:missing value, help:missing value, enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:"AXFullScreenButton", selected:missing value, name:missing value, description:"bouton plein écran"}, 
		{minimum value:missing value, orientation:missing value, position:{701, 450}, class:button, role description:"bouton", accessibility description:missing value, focused:false, title:"Texte", size:{186, 44}, value:missing value, help:"Chacune des icônes de document ouvre un nouveau document du type spécifié.", enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:missing value, selected:missing value, name:"Texte", description:"bouton"}, 
		{minimum value:missing value, orientation:missing value, position:{701, 504}, class:button, role description:"bouton", accessibility description:missing value, focused:false, title:"Classeur", size:{186, 44}, value:missing value, help:"Chacune des icônes de document ouvre un nouveau document du type spécifié.", enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:missing value, selected:missing value, name:"Classeur", description:"bouton"}, 
		minimum value:missing value, orientation:missing value, position:{701, 558}, class:button, role description:"bouton", accessibility description:missing value, focused:false, title:"Présentation", size:{186, 44}, value:missing value, help:"Chacune des icônes de document ouvre un nouveau document du type spécifié.", enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:missing value, selected:missing value, name:"Présentation", description:"bouton"}, 
		
?????		{minimum value:missing value, orientation:missing value, position:{701, 624}, class:menu button, role description:"bouton de menu", accessibility description:"", focused:true, title:"Ouvrir", size:{186, 44}, value:"Ouvrir...", help:"L'icône Ouvrir un document présente une boîte de dialogue d'ouverture de fichier.", enabled:true, maximum value:missing value, role:"AXMenuButton", entire contents:{}, subrole:missing value, selected:missing value, name:"Ouvrir", description:""}, 
		{minimum value:missing value, orientation:missing value, position:{1006, 450}, class:button, role description:"bouton", accessibility description:missing value, focused:false, title:"Dessin", size:{186, 44}, value:missing value, help:"Chacune des icônes de document ouvre un nouveau document du type spécifié.", enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:missing value, selected:missing value, name:"Dessin", description:"bouton"}, 
		{minimum value:missing value, orientation:missing value, position:{1006, 504}, class:button, role description:"bouton", accessibility description:missing value, focused:false, title:"Base de données", size:{186, 44}, value:missing value, help:"Chacune des icônes de document ouvre un nouveau document du type spécifié.", enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:missing value, selected:missing value, name:"Base de données", description:"bouton"}, 
		{minimum value:missing value, orientation:missing value, position:{1006, 558}, class:button, role description:"bouton", accessibility description:missing value, focused:false, title:"Formule", size:{186, 44}, value:missing value, help:"Chacune des icônes de document ouvre un nouveau document du type spécifié.", enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:missing value, selected:missing value, name:"Formule", description:"bouton"}, 
		{minimum value:missing value, orientation:missing value, position:{1006, 624}, class:button, role description:"bouton", accessibility description:missing value, focused:false, title:"Modèles", size:{186, 44}, value:missing value, help:"L'icône Modèles ouvre la boîte de dialogue Modèles et documents.", enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:missing value, selected:missing value, name:"Modèles", description:"bouton"}, 
		{minimum value:missing value, orientation:missing value, position:{701, 750}, class:toolbar, role description:"barre d'outils", accessibility description:"", focused:false, title:missing value, size:{105, 39}, value:missing value, help:"Cliquez sur une icône pour ouvrir un nouveau document ou une boîte de dialogue de fichier.", enabled:missing value, maximum value:missing value, role:"AXToolbar", entire contents:{}, subrole:missing value, selected:missing value, name:"Tool Bar", description:""}, 
		{minimum value:missing value, orientation:missing value, position:{919, 107}, class:static text, role description:"texte", accessibility description:missing value, focused:false, title:missing value, size:{75, 17}, value:"OpenOffice", help:missing value, enabled:true, maximum value:missing value, role:"AXStaticText", entire contents:{}, subrole:missing value, selected:missing value, name:"OpenOffice", description:"texte"}}
		*)
		click first menu button
		delay 0.2
		class of UI elements
		--> {button, button, button, button, button, button, button, menu button, button, button, button, button, toolbar, static text}
	end tell # window 1
end tell # System Events.

Are you trying to trigger the item which I flagged with “???”
It’s not a pop up button but a menu button.
As you may see, when the script click it, it doesn’t reveal the wanted menu items.

Yvan KOENIG (VALLAURIS, France) dimanche 14 septembre 2014 14:40:24

Hi Yvan (bonjour !)

The window I am trying to deal with is not the same.

See the following link :

https://dl.dropboxusercontent.com/u/14579664/openingcsv.jpg

When I use the “properties of UI elements” with this window, I get an empty array.

I am certainly doing something the wrong way ?

Regards,
Nicolas

Hello

It seems that you aren’t doing any wrong action.

I ran :

set p2d to path to desktop as text
set theCSV to p2d & "sample.csv:Feuille 1-Tableau 1.csv"

tell application "OpenOffice"
	activate
	open file theCSV
end tell
tell application "System Events" to tell process "OpenOffice"
	repeat until exists window 1
		delay 0.1
	end repeat
	set {wLeft, wTop} to position of window 1
	set {wWidth, wHeight} to size of window 1
	-- tell me to do shell script "/usr/bin/cliclick dc:" & wLeft + 14 & "," & wTop + 28
	--click window 1
	tell window 1
		properties of UI elements
		
	end tell # window 1
end tell # System Events.

Apple’s Accessibility Inspector allow me to get the properties of every UI elements embedded in the window but I can’t get them with the script.
As yo may guess reading the disabled instructions, I tried to click in the window or to double click in it using cliclick but got nothing.

I ran also the trial version of Bill Cheeseman’s UI Browser and was unable to get the properties of the window elements with it.
If Bill read this thread, maybe he would be able to explain what is striking and give a workaround but at this time, I must write that I am unable to solve the problem.
My understanding is that you must move back to the old version waiting for some enhancements.
You may also describe the problem to the openOffice developers team.

Yvan KOENIG (VALLAURIS, France) dimanche 14 septembre 2014 18:03:00

Thanks again !

I reverted back to the previous version of OpenOffice, and my script works again like a charm (thanks to Time Machine !)

Regards,
Nicolas