How To Script Any Windows application

0 views
Skip to first unread message
Message has been deleted

Phyllis Sterlin

unread,
Jul 11, 2024, 8:32:27 PM7/11/24
to ilcabfona

I've read plenty of the stackoverflow entries regarding compiling Python scripts into executable files. I am a bit confused as there are many options but some seem dated (no updates since 2008) and none were simple enough for me not to be asking this right now after a few hours spent on this.

How to script any Windows application


Download Zip >>> https://urlcod.com/2yM1QO



I would join @Nicholas in recommending PyInstaller (with the --onefile flag), but be warned: do not use the "latest release", PyInstaller 1.3 -- it's years old. Use the "pre-release" 1.4, download it here -- or even better the code from the svn repo -- install SVN and run svn co pyinstaller.

As @Nicholas implies, dynamic libraries cannot be run from the same file as the rest of the executable -- but fortunately they can be packed together with all the rest in a "self-unpacking" executable that will unpack itself into some temporary directory as needed; PyInstaller does a good job at this (and at many other things -- py2exe is more popular, but pyinstaller in my opinion is preferable in all other respects).

You could create an installer for you EXE file by:
1. Press WinKey + R
2. Type "iexpress" (without quotes) into the run window
3. Complete the wizard for creating the installation program.
4. Distribute the completed EXE.

Since I hate repetitive clicking, on grounds of both laziness and the amount of errors that a human introduces, I would like to drive this program automatically. The program in question doesn't support scripting, there is no API, no COM, nada, nyet, nravin. As far as I can tell, the only way to drive this program automatically is to imitate a human (i.e. keyboard and mouse macros.)

One way to do this would be to just wait ten minutes and hope that the simulation has finished. An alternative way is to make it event-driven, i.e. watch for the "Simulation running..." dialog to disappear and be replaced by a "Simulation complete" dialog.

Some of the keyboard input required is different for each simulation run. For example the simulation description might take the format [Project name][Scenario name][Option 1][Option 2]... and this would have to be entered for each simulation.

I will accept any solution that fits the criteria above, but I have a strong preference for something I can drive from Python. However I would also accept automated GUI-testing tools that I could customise to do what I want - possibly a Win32 GUI equivalent of Selenium for browsers? - keyboard macro recorders that will generate custom output, or anything else that works.

Sikuli is a visual technology to automate and test graphical user interfaces (GUI) using images (screenshots). Sikuli includes Sikuli Script, a visual scripting API for Jython, and Sikuli IDE, an integrated development environment for writing visual scripts with screenshots easily. Sikuli Script automates anything you see on the screen without internal API's support. You can programmatically control a web page, a Windows/Linux/Mac OS X desktop application, or even an iphone or android application running in a simulator or via VNC.

I saw this in a demo - On a working pop up window for an incoming call - this demo has a button that launched a client application. So an application using the Genesys integration plugin to put third party apps in iframes. When I am in the script editor I do NOT see the Client Application as an option as a Click Action for a button. is there another way I should call the app? Or am I missing some option that needs to be enabled? I do have the data action enabled as I am doing APIs in the script.

I should also say I do have the Apps button in genesys at the top and I do have access to my custom client app and it works fine in an iframe. I just cant seem to make a custom button in a script to launch it.

One more addition - The reason to have a button to launch a client integration app is that I want to have the cache ability of the application. If I use a Open URL in the script to just open a window to the client application - soon as the agent goes away from that window or the pop up closes that screen is gone. Where as from documentation the Client App has some caching of session - looks like up to 10. So reason I am trying to find use that feature rather then simply open URL

Do you remember where you saw the demo of this behavior? I've never seen a Genesys Script pop a Client Application in of the iframe locations available in Genesys Cloud. I do believe that deep links are supported, so my guess is that someone probably figured out what the URL was to the Client App iframe and then used that URL in the Script button to launch it.

Hey Crespino --- So I may have been wrong above. I have the demo recording as it was shown to a co worker during a teams call. The button actually is doing a Open URL to another frame in a script. I was able to recreate it that way. So yeah it wasn't actually opening the app =(

To that end and judging by your response - There is no actual way to call an app from a script correct? A use case is that upon answering an incoming call we want to pop an app to be in focus - and on the backend do some API calls. The only piece I am having trouble with is trying to get the App to open and focus. The issue with Open URL is that soon as the pop up is done the session is killed.

So your timing is pretty good here. By mid-July we are going to launch a feature called the Default Panel Manager that lets you define which widget (Genesys or 3rd Party) should be popped to have focus when an agent accepts an interaction. I think that will do the trick for you without having to jump through hoops with a script.

If if is not JMP then that would suggest a problem with file associations. If it is JMP, then I'm not sure why a change from Windows 7 to 10 would make a difference but you could try putting "//! " at the beginning of the script (this instructs JMP to run the script when it is "opened" - for example:

Save it as a .ps1 file. After enabling script execution (see Enabling Scripts in the PowerShell tag wiki), you can pass it one or two strings: the name of the executable and optionally the arguments line. For example:

SYNTAX Start-Process [-FilePath] [[-ArgumentList] ] [-Credential ] [-WorkingDirectory ] [-LoadUserProfile] [-NoNewWindow] [-PassThru] [-RedirectStandardError ] [-RedirectStandardInput ] [-RedirectStandardOutput ] [-Wait] [-WindowStyle Minimized ] [-UseNewEnvironment] []

killing explorer kills all explorer windows, I run this batch file after start up, so killing explorer is no issue for me.You can seemingly have multiple explorer processes and kill them individually but I could not get it to work.killing cmd.exe is to close the CMD window which starts because of the bad apps erroring.

All supported versions of Windows and Windows Server have a set of Win32 console commands built in. This set of documentation describes the Windows Commands you can use to automate tasks by using scripts or scripting tools.

Windows has two command-line shells: the Command shell and PowerShell. Each shell is a software program that provides direct communication between you and the operating system or application, providing an environment to automate IT operations.

The Command shell was the first shell built into Windows to automate routine tasks, like user account management or nightly backups, with batch (.bat) files. With Windows Script Host, you could run more sophisticated scripts in the Command shell. For more information, see cscript or wscript. You can perform operations more efficiently by using scripts than you can by using the user interface. Scripts accept all commands that are available at the command line.

PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets. Cmdlets are similar to Windows Commands but provide a more extensible scripting language. You can run both Windows Commands and PowerShell cmdlets in PowerShell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.

A reference of exit and error codes for Windows Commands can be found in the Debug system error codes articles that may be helpful to understanding errors produced. Windows Commands also include command redirection operators. To learn more of their use, see Using command redirection operators.

You can configure the Command shell to automatically complete file and directory names on a computer or user session when a specified control character is pressed. By default this control character is configured to be the tab key for both file and directory names, although they can be different. To change this control character, run regedit.exe and navigate to either of the following registry keys and entries, depending on whether you wish to change the value for the current user only, or for all users of the computer.

Set these values to that of the control character you wish to use. See virtual key codes for a complete list. To disable a particular completion character in the registry, use the value for space (0x20) as it isn't a valid control character. The type of value for this registry entry is REG_DWORD, and can also be specified by hexadecimal or decimal value.

You can also enable or disable file and directory name completion per instance of a Command shell by running cmd.exe with the parameter and switch /F:ON or /F:OFF. If name completion is enabled with the /F:ON parameter and switch, the two control characters used are Ctrl-D for directory name completion and Ctrl-F for file name completion. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

7fc3f7cf58
Reply all
Reply to author
Forward
0 new messages