|
Post by Julio on Mar 3, 2022 12:33:48 GMT
Hi Steve.
It is not the first time that I request improvements in the use of accentuated characters in the IF | WINDOW TITLE condition.
I have Google Chrome installed in Spanish with Windows 10 and with the settings tab ("Configuración" in Spanish) active. The Chrome icon on the taskbar reads "Configuración - Google Chrome"
Now I find that to the following statement :
1 | IF | WINDOWS TITLE | Configuración - Google Chrome | EXISTS | MESSAGE PROMPT | Exists::::0::OK | ELSE | 1 | RUN ACTION | MESSAGE PROMPT | Does not exist::::0::OK
MMM always answers "Does not exist" due to the presence of the accentuated character "ó".
( If there are no accentuated characters in the title of the active tab, the IF | WINDOW TITLE condition works perfectly.
It also works well with windows of other applications, for example with Notepad ("Bloc de notas" in Spanish). This works correctly with the following statement:
1 | IF | WINDOWS TITLE | Configuración: Bloc de notas | EXISTS | MESSAGE PROMPT | Exists::::0::OK | ELSE | 1 | RUN ACTION | MESSAGE PROMPT | Does not exist::::0::OK
Please, can you help me?
Thank you very much.
|
|
|
Post by philranger on Mar 4, 2022 2:54:00 GMT
Hi Julio,
Just a wild guess: if you put the name in a string before and search for that string, does itchange anything?
|
|
|
Post by Julio on Mar 4, 2022 15:23:21 GMT
I have created a macro with these 2 lines with active tab "Configuración - Google Chrome". On line 1, "Image.bmp" is a clipped portion of the active tab.
1 | RUN ACTION | MOUSE TO IMAGE | image path C: \ Users \ User \ OneDrive \ Documents \ Mini Mouse Macro \ Image.bmp :: at 250 550 320 170 :: match quick :: move mouse yes
2 | IF | WINDOWS TITLE | Configuración - Google Chrome | EXISTS | MESSAGE PROMPT | Exists::::0::OK | ELSE | 1 | RUN ACTION | MESSAGE PROMPT | Does not exist::::0::OK
When executing the macro, in line 1 it puts the mouse in the middle of the image "Image.bmp" and line 2 responds "Does not exist".
|
|
|
Post by philranger on Mar 7, 2022 12:36:46 GMT
Whenever I have problems to fully automate, I do half automation. For exemple, in this case, you could prompt the user to click in the « configuracion » window and then press enter. If it is already open and on the screen, an image detection would work after that, or a keypress Alt+ | tab to get back to that program.
|
|
|
Post by Julio on Mar 7, 2022 15:32:03 GMT
I think I'm not explaining myself well.
The only thing I wanted to say is that the IF | WINDOW TITLE condition does not work when the open Chrome window has accentuated characters in its title, such as the settings window ("Configuración" in spanish)
In the example above I wanted to explain that despite having the "Configuración" window open and active (move the mouse over an image of it), it still says not exist the "Configuración" window. It is not a real program.
My program is as follows:
................
* | Esperar
1 | RUN ACTION | WAIT MILLISECONDS | 2
2 | IF | WINDOW TITLE | Configuración - Google Chrome | NOT EXIST | GOTO MACRO LINE | Esperar
.............
With these instructions I want to make the program wait until the window whose title is "Configuración" has been completely loaded, because sometimes Chrome takes a few seconds to load a new window. In this case the program always stays in an indefinite loop, even though the window has been loaded. On the other hand, this indefinite loop does not occur if the title of the window does not have accentuated characters.
|
|
|
Post by philranger on Mar 7, 2022 18:06:13 GMT
Thanks for the explanations. I don’t know how to help then, sorry!
|
|
|
Post by Steve on Mar 7, 2022 21:20:54 GMT
................ * | Esperar 1 | RUN ACTION | WAIT MILLISECONDS | 2 2 | IF | WINDOW TITLE | Configuración - Google Chrome | NOT EXIST | GOTO MACRO LINE | Esperar ............. With these instructions I want to make the program wait until the window whose title is "Configuración" has been completely loaded, because sometimes Chrome takes a few seconds to load a new window. In this case the program always stays in an indefinite loop, even though the window has been loaded. On the other hand, this indefinite loop does not occur if the title of the window does not have accentuated characters. Hi Julio, Yeah this is good one. I tried this in a notepad document 'Configuración notepad.txt' and yep, it found the window title no problem. Its interesting that when reading the title from a chrome tab it works differently. I'm not sure why this is. I'd have to agree with philranger on this one in that sometimes you might just need a workaround. Unfortunately I don't think I can fix this in the code or 'factor' it in easily. Can you trigger your condition via a different queue? Such as an image or process? What exactly are you trying to do that requires this window title to be present?
|
|
|
Post by Julio on Mar 8, 2022 18:55:19 GMT
Thank you very much Steve for your answer.
I had also seen that with Notepad windows it worked.
I have tried with the window of an image the condition IF | WINDOW TITLE and it doesn't work at all: both with accented characters in the title and unaccented.
I use the "Configuración" window as an example. With it I test how MMM works with Chrome tabs that have Spanish accented characters (á, é, í, ó, ú, ñ) in their titles.
As I said in a previous post, it often happens that Chrome takes time to load certain web pages. To do this I use a loop like this:
................
* | Expect
1 | RUN ACTION | WAIT MILLISECONDS two
2 | IF | WINDOWS TITLE | Settings - Google Chrome | NOT EXIST | GOTO MACRO LINE | Expect
.............
This loop allows MMM to wait until the corresponding web (opened before) has been fully loaded, before continuing with the following instructions. Because if the web wasn't loaded, those instructions would fail.
This loop works fine with any tab that doesn't have accented characters in its title, but gets stuck in an infinite loop when it does.
On the other hand, I have seen that the condition RUN ACTION | SELECT WINDOW BY NAME does recognize accented characters in Chrome tab names.
The following statement works fine despite having the accented "ó" character in the Chrome window name.
1 | RUN ACTION | SELECT WINDOW BY NAME | Settings - Google Chrome
It would be a pity if you couldn't solve this problem.
|
|
|
Post by Julio on Mar 8, 2022 18:59:49 GMT
Thank you very much Steve for your answer.
I had also seen that with Notepad windows it worked.
I have tried with the window of an image the condition IF | WINDOW TITLE and it doesn't work at all: both with accented characters in the title and unaccented.
I use the "Configuración" window as an example. With it I test how MMM works with Chrome tabs that have Spanish accented characters (á, é, í, ó, ú, ñ) in their titles.
As I said in a previous post, it often happens that Chrome takes time to load certain web pages. To do this I use a loop like this:
................
* | Expect
1 | RUN ACTION | WAIT MILLISECONDS | 2
2 | IF | WINDOWS TITLE | Configuración - Google Chrome | NOT EXIST | GOTO MACRO LINE | Expect
.............
This loop allows MMM to wait until the corresponding web (opened before) has been fully loaded, before continuing with the following instructions. Because if the web wasn't loaded, those instructions would fail.
This loop works fine with any tab that doesn't have accented characters in its title, but gets stuck in an infinite loop when it does.
On the other hand, I have seen that the condition RUN ACTION | SELECT WINDOW BY NAME does recognize accented characters in Chrome tab names.
The following statement works fine despite having the accented "ó" character in the Chrome window name.
1 | RUN ACTION | SELECT WINDOW BY NAME | Settings - Google Chrome
It would be a pity if you couldn't solve this problem.
|
|
|
Post by Steve on Mar 8, 2022 22:13:09 GMT
The following statement works fine despite having the accented "ó" character in the Chrome window name. 1 | RUN ACTION | SELECT WINDOW BY NAME | Settings - Google Chrome It would be a pity if you couldn't solve this problem. Hi Julio, I had a look at the code behind the IF | WINDOW and the RUN ACTION | SELECT WINDOW BY NAME and they are different. The IF WINDOW code is using the FindWindow function and the SELECT WINDOW BY NAME is using AppActivate function. I will look into changing the IF WINDOW to use AppActivate instead of FindWindow. I will add it to my list for the next update. In the mean time how about extending the wait seconds time to something larger and not using the window title to catch your condition. Does the page load a fixed image or a banner that is always constant? If it does you might be able to use DETECT IMAGE ( www.turnssoft.com/conditions.html#detectimage) as your trigger to progress.
|
|
|
Post by Julio on Mar 9, 2022 9:20:18 GMT
Thanks a lot Steve for the change in the IF | WINDOW TITLE code and for your advice.
|
|
|
Post by Julio on Mar 25, 2022 19:48:41 GMT
Hi Steve.
In your last post in this thread, you said that in the next version you would modify the code behind IF | WINDOW TITLE for this condition to work well with accented characters.
Well, I have verified that in the latest version 8.3.3 of MMM, the following instruction is still not executed correctly:
1 | IF | WINDOWS TITLE | Configuración - Google Chrome | EXISTS | MESSAGE PROMPT | Exists::::0::OK | ELSE | 1 | RUN ACTION | MESSAGE PROMPT | Does not exist::::0::OK
|
|
|
Post by Steve on Mar 25, 2022 20:54:40 GMT
Hi Steve. In your last post in this thread, you said that in the next version you would modify the code behind IF | WINDOW TITLE for this condition to work well with accented characters. Well, I have verified that in the latest version 8.3.3 of MMM, the following instruction is still not executed correctly: 1 | IF | WINDOWS TITLE | Configuración - Google Chrome | EXISTS | MESSAGE PROMPT | Exists::::0::OK | ELSE | 1 | RUN ACTION | MESSAGE PROMPT | Does not exist::::0::OK Hi Julio, I said I would look into changing the code behind the IF WINDOW TITLE. I did look into changing it and its not a simple change. The AppActivate method can only be used to switch focus to a new window title. This is not what we want with the IF condition. Unfortunately I haven't got a solution for the accented characters.
|
|
|
Post by philranger on Mar 29, 2022 16:38:42 GMT
Hello,
Since it is complex, I would suggest a workaround: instead of waiting until the window exists, wait until the picture of the window exists. You could either detect the window title bar or detect a specific part of the web page is on screen
1 | IF | DETECT IMAGE | image path C:\images\header.bmp::match quick::move mouse no | IMAGE NOT FOUND | CONTINUE
|
|
|
Post by Julio on Mar 31, 2022 8:36:21 GMT
Hi Philranger.
Thank you so much for your advice.
That's exactly what Steve told me in his post on March 8, 2022.
Greetings
|
|
|
Post by philranger on Apr 4, 2022 19:49:25 GMT
No problem, I wanted to know if you understood and tried it since you didn’t answer his proposal.
|
|
|
Post by cyberchipz on Apr 28, 2022 15:39:16 GMT
Hi Philranger. Thank you so much for your advice. That's exactly what Steve told me in his post on March 8, 2022. Greetings I find that using quick image find works well for finding any image that exists, like a logo. Since it runs pretty quickly, this will allow you to KNOW that page not only exists; but is visible. Because the internet can lag; this is a great way to handle problems on the internet; I'm thinking even an image of the Title will work but I haven't tried that, I have too many tabs. To do this, take a screen shot of the page you want; crop out the image you want the code to recognize; and save it as a .bmp file and use this command. with either IMAGE FOUND or IMAGE NOT FOUND, or both if needed. Of course, if they change the logo or the image you capture, you'll need to capture it again. ;-) You'll find this is handy for a lot of stuff! Finding buttons.. etc. Capture the X, Y location (center of the image) and click it later, if it's a button or something to click. I have to use this all the time to handle lag. My high speed internet is rural and pretty slow compared to city internet. And in game play, it's great for handling lag. :-) 24 | IF | DETECT IMAGE | image path C:\LogoOrImage.bmp::match quick::move mouse no::save to vars TLCX TLCY | IMAGE NOT FOUND | GOTO MACRO LINE | FailedToFind
or
24 | IF | DETECT IMAGE | image path C:\LogoOrImage.bmp::match quick::move mouse no::save to vars TLCX TLCY | IMAGE FOUND | GOTO MACRO LINE | FoundIt
I also use it to know when the page closes so I can continue with code for other pages.
|
|