Support > Forums > OpenBots Studio > Hide/unhide Excel Sheets (v1.7)

Hide/unhide Excel Sheets (v1.7)

David Santos

  • Reporter
  • Calender Icon December 19,2021 at 9:15 AM

Hi Openbots experts. To hide or unhide an excel sheet I have tried diferent workarounds since there is no a direct command to handle this action in the Excel library. During one test I tried to use the UI Desktop to record a sequence of clicks (select home tab> right click> hide> right click (other tab)>unhide) but when recording this sequence of clicks I got the error below and the Studio window was closed. Regards.

Excepci�n no controlada en la aplicaci�n. Si hace Clic en continuar la aplicaci�n omitir� este error e intentar� continuar. Si hace clic en salir la aplicaci�n se cerrar inmediatamente.

El valor no puede ser nulo. Nombre de parametro element

Consulte el final de este mensaje para obtener m�s detalles sobre c�mo invocar a la depuraci�n Just-In-Time (JIT) en lugar de a este cuadro de di�logo.

************** Texto de la excepci�n ************** System.ArgumentNullException: El valor no puede ser nulo. Nombre del par�metro: element en System.Windows.Automation.TreeWalker.GetParent(AutomationElement element) en OpenBots.Commands.UIAutomation.Library.DesktopHelper.GetParentAutomationElements(AutomationElement element) en C:\Users\OpenBotsAdmin\source\repos\Devops\OpenBots.Studio\OpenBots.Commands\OpenBots.Commands.UIAutomation\Library\DesktopHelper.cs:l�nea 565 en OpenBots.Commands.UIAutomation.Library.DesktopHelper.LoadTreeView(List1 renderedControls, AutomationElement targetElement, ScriptCommand command) en C:\Users\OpenBotsAdmin\source\repos\Devops\OpenBots.Studio\OpenBots.Commands\OpenBots.Commands.UIAutomation\Library\DesktopHelper.cs:l�nea 490 en OpenBots.Commands.UIAutomation.Library.DesktopHelper.ShowRecorder_Click(Object sender, EventArgs e, ICommandControls commandControls, List1 renderedControls, ScriptCommand command, CommandItemControl validatorControl) en C:\Users\OpenBotsAdmin\source\repos\Devops\OpenBots.Studio\OpenBots.Commands\OpenBots.Commands.UIAutomation\Library\DesktopHelper.cs:l�nea 481 en OpenBots.Commands.UIAutomation.Library.DesktopHelper.<>c__DisplayClass25_0.<CreateRecorderControl>b__0(Object s, EventArgs e) en C:\Users\OpenBotsAdmin\source\repos\Devops\OpenBots.Studio\OpenBots.Commands\OpenBots.Commands.UIAutomation\Library\DesktopHelper.cs:l�nea 376 en System.Windows.Forms.Control.OnClick(EventArgs e) en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) en System.Windows.Forms.Control.WndProc(Message& m) en System.Windows.Forms.ScrollableControl.WndProc(Message& m) en System.Windows.Forms.ContainerControl.WndProc(Message& m) en System.Windows.Forms.UserControl.WndProc(Message& m) en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) en System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

[...]

************** Depuraci�n JIT ************** Para habilitar la depuraci�n Just In Time (JIT), el archivo de configuraci�n de esta aplicaci�n o equipo (machine.config) debe tener el valor jitDebugging establecido en la secci�n system.windows.forms. La aplicaci�n tambi�n se debe compilar con la depuraci�n habilitada

Por ejemplo:

<configuration> <system.windows.forms jitDebugging="true" /> </configuration>

Cuando est� habilitada la depuraci�n JIT, cualquier excepci�n no controlada se enviar� al depurador JIT registrado en el equipo en lugar de controlarlo mediante el cuadro de di�logo.

This forum has 317 topics, 687 replies, and was last updated 4 months ago by Nataly Alvarado...

Lakshmi Sukumar

  • Participant
  • Calender Icon December 20,2021 at 8:24 PM

Hi David,

If there is something that cannot be done with our preset commands, we recommend to use an Excel Macro when possible. Else, sending hotkeys and Desktop command actions should also allow you to perform actions in Excel through its UI.

I was able to recreate the sequence you mention in this forum "(select home tab> right click> hide> right click (other tab)>unhide)" using the Desktop Click element command. However, make sure that if an element vanishes (like it does when you click on "Hide"), you hold the click at time of recording. This is because the element vanishes before the recorder is able to capture it, which is why it gives you the mentioned error. Another option is to capture the element by doing a right click instead of a left click, that way the element won't vanish.

You are not authorized to reply, please click here to login and add your reply to this topic.