Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
Gregory Diebold
49 discussion posts
I am attempting to run 2 security camera apps back to back within a custom script. The first one loads without a need for username or password, but the second app requires a username & password plus a few mouse clicks to open the camera group.

Referencing the .pdf attachment:

The code on the left with the ✔️ runs correctly 95% of the time; however, depending on the processor load, the section with the mouse clicks is not run in the order intended.

-It seems to fail mostly after a cold start.
-If the script has been run before,it works correctly nearly 100% of the time, launching both apps and then focusing on the second app & performing the correct mouse clicks.. I'm guessing that's due to the apps being read from cache, reducing load time.
-I experimented with .Sleep() & .Threadwait(), but successful results were not consistant.

Given this dilemma, I considered running each camera's actions in its own Thread() &/or Process as a solution. This was an educated guess, but I wanted a way to stop the app loadings from interfering with the other apps scripting.

At right (?) is my first attempt at threading. It runs; however, the results are disappointly the same as above. I guess threading is not the solution needed.

Any suggestions?
• Attachment: process & Threading.pdf [153,099 bytes]
Dec 8, 2023 (modified Dec 8, 2023)  • #1
User Image
Gregory Diebold
49 discussion posts
...............
Dec 8, 2023 (modified Dec 8, 2023)  • #2
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Did you already try a ThreadWait between each line in that VINYL Mouse Clicks section? If so, how long did you set the ThreadWaits to?
Dec 8, 2023  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Did you already try a ThreadWait between each line in that VINYL Mouse Clicks section? If so, how long did you set the ThreadWaits to?
Dec 8, 2023  • #4
User Image
Gregory Diebold
49 discussion posts
No, just before and after that snippet. My session had expired so that's why everything seemed locked earlier.

BFS.General.Sleep(5000);

/* VINYL Mouse Clicks */
// Pick APT group; Click show/hide cams
BFS.Input.SetMousePosition(2095, 230);
BFS.Input.LeftClickMouse();
BFS.Input.SetMousePosition(1964, 182);
BFS.Input.LeftClickMouse();
BFS.General.Sleep(500);
Dec 8, 2023 (modified Dec 8, 2023)  • #5
User Image
Gregory Diebold
49 discussion posts
I've found the most stable solution is to do all the Vinyl loading, keyboard stuffing, and mose clicks before I loaded the Tint app. The inconsistant loading time of Tint is what was causing the problems.

public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
BFS.Audio.PlayFile("C:\\Windows\\Media\\Windows Proximity Connection.wav");

/* VINYL */
BFS.DisplayFusion.RunFunction("Focus 2");
BFS.General.Sleep(500);
BFS.Application.Start("C:\\Program Files (x86)\\YIHomePCClientIntl\\YIHomePCClientIntl.exe");
BFS.General.ThreadWait(4500);
BFS.Input.SendKeys("+({VK_50}{VK_65}){VK_76}{VK_76}{VK_80}{VK_82}{VK_79}");
BFS.Input.SendKeys("{VK_13}");

/* VINYL Mouse Clicks */
// Pick APT group; Click show/hide cams
BFS.General.Sleep(1000);
BFS.Input.SetMousePosition(2095, 230);
BFS.General.ThreadWait(500);
BFS.Input.LeftClickMouse();
BFS.General.ThreadWait(500);
BFS.Input.SetMousePosition(1964, 182);
BFS.General.ThreadWait(500);
BFS.Input.LeftClickMouse();
BFS.General.Sleep(500);


/* TINT */
BFS.Audio.PlayFile("C:\\Windows\\Media\\tada.wav");
BFS.DisplayFusion.RunFunction("Focus 1");
BFS.General.Sleep(500);
BFS.Application.Start("D:\\APT SMART PSS\\Smart Professional Surveillance System\\SmartPSS\\SmartPSS.exe");
BFS.General.ThreadWait(5000);

/*
// Max Vinyl Bay window
Dec 8, 2023  • #6
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Glad to hear you found a good solution!
Dec 11, 2023  • #7
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)