Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
John Rothamel
2 discussion posts
Hello. I'm trying to write a script that will press enter on an application's inactive warning pop up windowfor the windows default button to stay logged in. I'm not really familar with the language and I don't want to spend days right now teaching myself.

Below is what I have. I've pieced it together from other scripts, it's quite simple. It's not working though. There is a trigger monitoring for the pop up window text of "Cherwell Inactivity Warning" which is in the title.

If the focus changes during the script, I would love to return to the prior application and cursor/mouse location before the pop up arrived once it's been satisified, but I can deal with that later.

Any help is greatly appreciated.
___________________________________________________________________________________
Imports System
Imports System.Drawing

' The windowHandle parameter will contain the window handle for the:
' - Active window when run by hotkey
' - Trigger target when run by a Trigger rule
' - TitleBar Button owner when run by a TitleBar Button
' - Jump List owner when run from a Taskbar Jump List
' - Currently focused window if none of these match

Public Class DisplayFusionFunction

Public Shared Sub Run(ByVal windowHandle As IntPtr)
BFS.Window.Focus(windowHandle)
BFS.Input.SendKeys("{Enter}")
End Sub

End Class
John R.
Jul 2, 2023  • #1
User Image
JLJTGR
94 discussion posts
Are you sure that pressing Enter will work on the dialog when focused? Custom windows have to designate what buttons are used for Enter/Esc. But Space will always activate the current tab-order button. If this window does not start with the correct button highlighted, you might use a TAB keystroke to move to it first. What I'm saying is, make sure that the keystrokes you're scripting really do work for this window.

Is the focus part of the script working? Is the trigger even firing at all? You can insert System.Windows.Forms.MessageBox.Show("test") to make sure that your script is even running from the trigger.

It's also possible that this window is running as administrator which makes it impossible for non-admin programs to manipulate them. DisplayFusion has an admin service, but I don't know if that is what is used for scripting.
Jul 2, 2023  • #2
User Image
John Rothamel
2 discussion posts
Thanks so much for posting. I added the line you suggested. I fact, I added one before each step. Still didn't work. I restarted display fusion and viola, it's working. Got each of the messages and had to click ok.

I commented the messages out and it's working perfectly. Hasn't timed out in 5 hours! So cool.

Thanks again! Have a great 4th!
John R.
Jul 3, 2023  • #3
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Glad to hear you got it sorted out. Thanks for the help @JLJTGR!
Jul 4, 2023  • #4
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)