AHK - Is there a way to know if the webpage is already loaded in google chrome? - autohotkey

I just wanted to ask if there is a way to know if the webpage is already loaded in google chrome using AHK? like if we using autohotkey to navigate to the webpage sometimes we use sleep function to kinda set intervals before the script continue to run, but using this methos is not that accurate and sometime some webpages load versy slowly and it will messed up your script. is there a way to know if the page is already loaded before the script continue on running?
Thank you

First things first. I am a non professional self taught BASIC Spaghetti programmer from the 80's. What you see below is what you get.
AHK and the browsers do not work well together. I use AHK mostly with FireFox but it seems to behave the same with Chrome
I use a script to send music to my stereo and do many mundane chores while I navigate through my daily news, whether, sports and click bait routine.
I can find the names of individual windows running within Firefox. The individual windows may each have a number of tabs but I can only see the name of the active tab within each of the individual FireFox windows.
Below is some code I copied out of the script that finds window names. All the individual FireFox window names end in "— Mozilla Firefox"
WinGet, WinList, List
Loop %WinList%
{
ID := WinList%A_Index%
WinGetTitle, Title, ahk_id %ID%
If (MusicPlayer = "Sting`nRay")
{
If (ID = IDStingRay)
{
Gosub GetSongTitle
Break
}
}
Else If InStr(Title, "Radio Caroline")
{
If InStr(Title, "www.radiocaroline") or InStr(Title, "Radio Caroline playlist")
{
RadioCarolinePlaylistTitle := "Radio Caroline playlist — Mozilla Firefox"
RadioCarolineToolTip := "Caroline On Line"
ToolTip, %RadioCarolineToolTip%, %TTx%, 24, 3
Break
}
Else If InStr(Title, "Caroline Community Radio")
{
RadioCarolinePlaylistTitle := "Caroline Community Radio — Mozilla Firefox"
RadioCarolineToolTip := "Caroline Community Radio On Line"
Break
}
Else If InStr(Title, "| Radio Caroline — Mozilla Firefox")
{
Gosub GetSongTitle
Break
}
}
}
One of the mundane tasks this script does is to make a list of the songs that play while the script is running.
In the above code the two windows titles that are actually playing music are "Sting Ray" and the one ending with "| Radio Caroline — Mozilla Firefox".
The others pages appear when announcers are announcing. For those that prefer music to announcing give Radio Caroline a listen. Much more playing than announcing and the announcing is mostly about the playing.
I would like to find the names of all the individual tabs within each FireFox window but that is beyond my pasta programing abilities.

Related

Delaying speech and text between Scenes

I have both a speech and text Prompt in a Scene and in the Scene that is transitioned to. The separate speech prompts are spoken with just a brief break between them. The text prompts are displayed as sentences in the same paragraph. Ideally, I would like a pause between the speech prompts, and a new paragraph between the text prompts.
How might I do this?
Scenes represent logical separations - not necessarily discrete UX elements. Each scene can put one or more prompts into the prompt queues (there are multiple queues - more on that in a moment). They're taking out of each queue in the order they were put in, unless you clear the queue before you add another item. However - the system treats all of the prompts in the queue as building towards a single reply. So there is no automatic way to visually or audibly separate them.
However, there are a couple of tricks you can use, with caveats.
Audibly, you can add a brief pause using the SSML break tag. So you might set your On Entry "speech" prompt response to something like:
<break time="250ms"/> Welcome to another scene.
However, splitting the response visually is more difficult. There is no formatting allowed in the text response. There are a couple of tricks you may be able to try, however, but they're not guaranteed to work on all visual displays.
The easiest might be to send the first part of your response as a firstSimple prompt, and the second part in a lastSimple prompt. Typically you'd use the first to give results from what the user might have just done, and the last to prompt them for further action, but they may be rendered as separate "bubbles" on some platforms.
You could also consider a rich response card. You an format the contents of the card a little, but you can't use two separate scenes to fill the contents of a single card. On some platforms, you can only show one card.

Creating user interface for ZORK style game in MATLAB

I'm trying to use MATLAB to create a stand-alone application for an interactive fiction game (where the player is presented with a text prompt and responds by entering text, e.g. "You are being choked by a creepy squid. >> " "Stab squid" "The squid dies, leaving behind an inky pile of gold. >>" etc.).
When I compile the game and install it, everything works smoothly, but there's nowhere for the game's prompts to appear, and nowhere for the user to type in responses.
Who has a good solution for this? Do I use a GUI with text boxes, or is there a way just to have a text scroll with user inputs like this? The latter would be preferable.
Thanks!

Controlling the mouse on the desktop with pywinauto

I am attempting to take control of mouse events on the desktop using pywinauto. Specifically, I am looking to make different applications active by sending a mouse click to their windows, and ideally to be able to move windows with well known title bar coordinates around.
I've tried doing app.connect_() calls to both "explorer" and "dwm" but with the exception of a DialogWrapper with the class "Progman" I've had no joy. Searching about with SWAPY has yielded similarly poor results.
I'm not a Windows programmer so I hope I'm missing something fairly obvious here. Any hints would be well received.
Thanks
Below is some code that will click on the desktop at (900, 50) using pywinauto.
Note that using ClickInput() rather than Click() is important.
import pywinauto.application
app = pywinauto.application.Application()
comapp = app.connect_(path = "explorer")
for i in comapp.windows_():
if "Progman" == i.FriendlyClassName():
i.ClickInput(coords=(900, 50))

How do I navigate from panel to panel in console mode of install4J installer?

well, all is in the title.
In InstallAnywhere when in console mode you type back or next or quit. I haven't seen something like this in install4j.
Thanks,
X.
In install4j, console mode shows the user interface as a continuous stream of questions and so it's not organized into separate screens.
However, the installer has a "Console screen change handler" property where you can implement something like that. For example with code like
if (context.getBooleanVariable("showConsoleNavigation")) {
if (console.askYesNo("Do you want to repeat the last step?")) {
context.goBackInHistory(1);
} else {
console.println("* " + title);
}
}
You would set the installer variable "showConsoleNavigation" to Boolean.TRUE once you want to start the navigation.

Perl GUI script that should work with the application minimzed. How make it stay that way? Focus related problem

I'm trying to develop a Perl script that controls an application in a very simple manner(fills some boxes, presses some keys).
I've implemented everything using Win32::GuiTest.
The goal is to make it work with the app being minimized in tray, allowing me to use the PC at the same time.
I'm using functions like: WMSetText , SelComboItem , SendMessage, PushChildButton.
All of them work fine, except for PushChildButton. Whenever this function is called, I'm losing focus(even though the controlled app stays minimized) from whatever I'm doing.
Application that I'm using before calling PushChildButton: http: // i. imgur.com/7B5kj.png
Application that I'm using after calling PushChildButton: http: // i. imgur.com/VCskW.png
I've tried killing the focus like this, but it did not work:
my $msg_id=0x08;
SendMessage( #_[ 0 ], $msg_id, #_[ 1 ], undef );
#_[ 0 ] - handle to the application
#_[ 1 ] -handle to the "Edit Control" that I think* that takes the focus after pressing the button
*Let me elaborate this a bit. The application still stays minimized, but sometimes that "Edit Control" resource contains strings that are concatenated with the keys that I've pressed while losing the focus.
PS: I'm a beginner with Perl and WinAPI(in fact this is my first project), so I might
have explained things a bit unclear. Please ask me everything that you feel that I
should elaborate.
Most likely this is a windows problem, not perl.
People do this normally with a normal window moved outside
the visible desktop range, e.g. to the left, x=-600.
Use Win32::GUI instead. This will save you many more headaches.