Jump to content
Macro Express Forums

How to make Firefox's Library receptive to keystrokes


Recommended Posts

In a macro to export bookmarks from Firefox, I can get it to display Library, but I don't know what code to insert so that 'ALT I' takes effect in the Library window to open the 'Import and BackUp' tool.

 

<LOCK PLAYER Wait="TRUE"/>
<COMMENT Value=" Launch Firefox and activate it"/>
<LAUNCH PROGRAM AND ACTIVATE WINDOW Title="Mozilla Firefox" Exact_Match="FALSE" Wildcards="FALSE" Path="C:\\Program Files\\Mozilla Firefox\\firefox.exe" Mode="\x00" Default_Path="FALSE" Wait="1" Wait_For_Program="12"/>
<DELAY Flags="\x02" Time="100"/>
<COMMENT Value="Get control of Firefox"/>
<GET CONTROL Flags="1" Program_Name="FIREFOX.EXE" Class="MozillaWindowClass" Title="Mozilla Firefox" Variable="%C[1]%" Caption="Mozilla Firefox" Partial="FALSE" Wildcards="FALSE"/>
<DELAY Flags="\x02" Time="100"/>
<COMMENT Value="CTRL SHIFT B Opens the Library"/>
<TEXT TYPE Action="0" Text="<CONTROL><SHIFT>B"/>

 

Link to comment
Share on other sites

In my version of Firefox (91.0.2) the following sequence opens the library, then the Import & Backup, then the Backup screen.  I'm not sure why you need a "GET CONTROL".

 

Text Type (Simulate Keystrokes): <CTRLD><SHIFTD>o<SHIFTU><CTRLU>    (library)
Delay: 250 milliseconds
Text Type (Simulate Keystrokes): <ALTD>I<ALTU>    (import/backup)
Delay: 250 milliseconds
Text Type (Simulate Keystrokes): B   (backup screen)

 

 

Link to comment
Share on other sites

It seems that I do NOT need to get control of Firefox. I can get the library to open, but I can't get ALT-I to have any effect in that Library.

I am using an older version of Firefox (and have reason for keeping it), and your code does not have the desired effect in it.

I have a PC with a v91 Firefox, and have tried your code - following on from my code for launching Firefox. Firefox launch is all that happens.

 

In have no trouble launching the Library, so I don't need :

Text Type (Simulate Keystrokes): <CTRLD><SHIFTD>o<SHIFTU><CTRLU>    (library)

 

but your  : Text Type (Simulate Keystrokes): <ALTD>I<ALTU>    (import/backup)

does not do the required activation in Library.

It's title, 'Library', looks greyed out  - I suspect that needs to be dealt with.

When I manually click in the Library window its name becomes ungreyed.

I may I need to GET CONTROL of Library  (don't know HOW) or set Focus on Library.

Link to comment
Share on other sites

Text Type (Simulate Keystrokes): <ALTD>I<ALTU>    (import/backup) 

 

I wonder whether the capitalized "i" is the problem. You may be sending Alt + Shift + i instead of Alt + i.

 

So experiment with these two alternatives:

 

Text Type (Simulate Keystrokes): <ALTD>i<ALTU> 
  
or
  
Text Type (Simulate Keystrokes): <ALT>i

 

 

Link to comment
Share on other sites

I tried lower case and upper case "I" and both worked.  Perhaps it IS a question of getting focus on the Library window.

In my Firefox version, the "I" of "Import and Backup" is underlined; so if yours is the same, it seems that <ALTD>I<ALTU> should work.  Easy to test manually.

Link to comment
Share on other sites

Maybe the 250 ms delay is not enough.

 

This sequence of keystrokes also navigates to "Import and Backup"...

 

Alt + O   // Organize

Left arrow

 

Is it possible the hotkey you have assigned to start this process conflicts with another hotkey?

 

Have you created a different macro that is triggered by pressing Alt + i ?

 

If it's truly a focus problem -- and I notice more focus-related issues in Windows 10 than in any previous version of Windows -- adding this step after calling up the Library window might help:

 

Window Activate: Library


<WINDOW ACTIVATE Title="Library" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>

 

 

Link to comment
Share on other sites

I have ALT-I allocated to a hotkey in WordPerfect-for-DOS, but that should not affect anything in Windows.

 

I did test the suggested code in Firefox v91 (64bits) and it did not SEEM to do anything.

 

Will certainly try the focus setting first - and report back when I have done it.

 

When I added

Window Activate: Library


to the code, the Library Window no longer has its name greyed out - so that is progress.

From there on the behaviour is inconsistent. The Export entry may or may not show.

 

Adding

<WINDOW ACTIVATE Title="Library" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>

reproduced the line

'Window Activate: Library'

rather than showing the detail visible above.

 

Changing 'ALT i' to the suggested alternative gives a more reliable progress to SAVE window. 

 

Link to comment
Share on other sites

I'm overjoyed to report that after much trial and error (mostly error), my code (improved with your suggestions) now manages to do 'the backup of up bookmarks' that was my aim. I am happy to post the code, if someone asks to see it.

 

HOWEVER

The most unexpected failure is that Firefox will not close at the end of the process.

 

<DELAY Flags="\x02" Time="1000"/>
<COMMENT Value="Shift focus to Firefox window"/>
<WINDOW ACTIVATE Title="New Tab - Mozilla Firefox" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
<DELAY Flags="\x02" Time="1000"/>
<COMMENT Value="Close the Firefox window"/>
<PROGRAM SHUT DOWN Option="\x01" Title="New Tab - Mozilla Firefox" Partial="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>

 

How can that code be improved to close Firefox ?

 

Link to comment
Share on other sites

Now and then a version of Firefox comes along that doesn't want to close.  I use a .bat file as shown below, to kill and restart Firefox.  There are multiple "taskkill" commands, because there tends to be more than one Firefox process running -- don't know why.  The .bat file can be launched from a macro:
   Program Launch: "c:\menus\kill_firefox.bat" (Normal) Parameters:


taskkill /F /IM firefox.exe
taskkill /F /IM firefox.exe
taskkill /F /IM firefox.exe
taskkill /F /IM firefox.exe
taskkill /F /IM firefox.exe
taskkill /F /IM firefox.exe
taskkill /F /IM firefox.exe
taskkill /F /IM firefox.exe
taskkill /F /IM firefox.exe
taskkill /F /IM firefox.exe

"C:\Program Files\Mozilla Firefox\firefox.exe"

Link to comment
Share on other sites

It's not obvious to me where you got that list of running processes. I looked in Task Manager's DETAILS tab and and found numerous entries for Chrome (which the macro CAN end), but only ONE for Firefox, which the macro can NOT end.

 

Just in case (Firefox) Library is less obstinate than Firefox itself, I ask for guidance to close the Library - accepting that maybe Firefox itself can not be closed.

Link to comment
Share on other sites

6 hours ago, Sebastian42 said:

It's not obvious to me where you got that list of running processes

I have a macro that does it, using the Repeat with Processes command:

 

<COMMENT Value=" "/>
<COMMENT Value=" "/>
<LOCK PLAYER Wait="TRUE" _ENABLED="FALSE"/>
<LOG MESSAGES Filename="C:\\Temp\\MacroExpressProLogFiles\\MacroExpressPro_Macro_Log_File.txt" Message="Macro executed: 0_Running_Processes_Display_on_Screen" Stamp="TRUE"/>
<LOG ERRORS Filename="C:\\Temp\\MacroExpressProLogFiles\\MacroExpressPro_Macro_Log_File.txt" Hide_Errors="FALSE"/>
<COMMENT Value=" "/>
<COMMENT Value="Display all running processes"/>
<COMMENT Value=" "/>
<COMMENT Value="....    set up CR-LF in T98"/>
<VARIABLE SET TO ASCII CHAR Value="13" Destination="%T[98]%"/>
<VARIABLE SET TO ASCII CHAR Value="10" Destination="%T[99]%"/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%T[98]%" Variable="%T[99]%" NoEmbeddedVars="FALSE"/>
<COMMENT Value=" "/>
<VARIABLE SET STRING Option="\x00" Destination="%T[1]%" NoEmbeddedVars="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%T[2]%" NoEmbeddedVars="FALSE"/>
<REPEAT WITH PROCESSES Destination="%T[1]%"/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%T[2]%" Variable="%T[1]%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%T[2]%" Variable="%T[98]%" NoEmbeddedVars="FALSE"/>
<END REPEAT/>
<COMMENT Value=" "/>
<COMMENT Value="Process names are stacked in T2 variable, with trailing CRLF. "/>
<COMMENT Value="Now split variable T2 out into an array, to be sorted.  Append CRLF to each name.  "/>
<SPLIT STRING Source="%T[2]%" SplitChar="%T[98]%" Dest="%ProcessNames%" Index="1"/>
<COMMENT Value=" "/>
<COMMENT Value="Testing, make sure last three array slots are full and all slots have some value"/>
<VARIABLE SET STRING Option="\x00" Destination="%ProcessNames[250]%" Value="ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%ProcessNames[300]%" Value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%ProcessNames[299]%" Value="YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%ProcessNames[298]%" Value="ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%sortindex1%" Value="1" _ENABLED="FALSE"/>
<GET ARRAY LENGTH Array="%ProcessNames%" Dest="%arraylength%" _ENABLED="FALSE"/>
<REPEAT UNTIL Variable="%sortindex1%" Condition="\x03" Value="%arraylength%" _ENABLED="FALSE"/>
<IF VARIABLE Variable="%ProcessNames[%sortindex1%]%" Condition="\x00" IgnoreCase="FALSE" _ENABLED="FALSE"/>
<VARIABLE SET STRING Option="\x00" Destination="%ProcessNames[%sortindex1%]%" Value="ZZ" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/>
<END IF _ENABLED="FALSE"/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%sortindex1%" _ENABLED="FALSE"/>
<END REPEAT _ENABLED="FALSE"/>
<COMMENT Value=" "/>
<COMMENT Value="Sort array of process names "/>
<GET ARRAY LENGTH Array="%ProcessNames%" Dest="%arraylength%"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%sortindex1%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%sortindex2%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%sortlimit%" Value="%arraylength%"/>
<VARIABLE MODIFY INTEGER Option="\x08" Destination="%sortlimit%"/>
<REPEAT UNTIL Variable="%sortindex1%" Condition="\x00" Value="%sortlimit%"/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%sortindex1%"/>
<VARIABLE MODIFY INTEGER Option="\x00" Destination="%sortindex2%" Value1="%sortindex1%" Value2="1"/>
<IF VARIABLE Variable="%ProcessNames[%sortindex1%]%" Condition="\x00" IgnoreCase="FALSE"/>
<REPEAT EXIT/>
<END IF/>
<REPEAT UNTIL Variable="%sortindex2%" Condition="\x03" Value="%arraylength%"/>
<TEXT BOX DISPLAY Title="Diagnostics -- indexes" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %sortindex1%\r\n\\par %sortindex2%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
<IF VARIABLE Variable="%ProcessNames[%sortindex2%]%" Condition="\x00" IgnoreCase="FALSE"/>
<REPEAT EXIT/>
<END IF/>
<IF VARIABLE Variable="%ProcessNames[%sortindex1%]%" Condition="\x03" Value="%ProcessNames[%sortindex2%]%" IgnoreCase="FALSE"/>
<VARIABLE MODIFY STRING Option="\x08" Destination="%tempname%" Variable="%ProcessNames[%sortindex1%]%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x08" Destination="%ProcessNames[%sortindex1%]%" Variable="%ProcessNames[%sortindex2%]%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x08" Destination="%ProcessNames[%sortindex2%]%" Variable="%tempname%" NoEmbeddedVars="FALSE"/>
<END IF/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%sortindex2%"/>
<END REPEAT/>
<END REPEAT/>
<COMMENT Value=" "/>
<COMMENT Value="Testing skip counting and removing duplicates *********************************************" _ENABLED="FALSE"/>
<IF VARIABLE Variable="%skip%" Condition="\x01" Value="%skip%" IgnoreCase="FALSE" _ENABLED="FALSE"/>
<COMMENT Value="Remove and count duplicate names from list "/>
<GET ARRAY LENGTH Array="%ProcessNames%" Dest="%arraylength%"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%sortindex1%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%sortindex2%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%sortlimit%" Value="%arraylength%"/>
<VARIABLE MODIFY INTEGER Option="\x08" Destination="%sortlimit%"/>
<REPEAT UNTIL Variable="%sortindex1%" Condition="\x00" Value="%sortlimit%"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%dupcount%" Value="1"/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%sortindex1%"/>
<VARIABLE MODIFY INTEGER Option="\x00" Destination="%sortindex2%" Value1="%sortindex1%" Value2="1"/>
<IF VARIABLE Variable="%ProcessNames[%sortindex1%]%" Condition="\x01" IgnoreCase="FALSE" _COMMENT="****1"/>
<REPEAT UNTIL Variable="%sortindex2%" Condition="\x03" Value="%arraylength%"/>
<TEXT BOX DISPLAY Title="Diagnostics -- indexes" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %sortindex1%\r\n\\par %sortindex2%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
<IF VARIABLE Variable="%ProcessNames[%sortindex2%]%" Condition="\x00" IgnoreCase="FALSE" _COMMENT="                     ****2"/>
<OR/>
<IF VARIABLE Variable="%ProcessNames[%sortindex2%]%" Condition="\x03" Value="%ProcessNames[%sortindex1%]%" IgnoreCase="FALSE"/>
<IF VARIABLE Variable="%dupcount%" Condition="\x03" Value="1" IgnoreCase="FALSE" _COMMENT="                                               ****3"/>
<VARIABLE MODIFY STRING Option="\x06" Destination="%ProcessNames[%sortindex1%]%" Value=" (" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x06" Destination="%ProcessNames[%sortindex1%]%" Value="%dupcount%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x06" Destination="%ProcessNames[%sortindex1%]%" Value=" instances)" NoEmbeddedVars="FALSE"/>
<REPEAT EXIT/>
<END IF _COMMENT="                                                                                                        ****3"/>
<END IF _COMMENT="                                                                             ****2"/>
<IF VARIABLE Variable="%ProcessNames[%sortindex1%]%" Condition="\x00" Value="%ProcessNames[%sortindex2%]%" IgnoreCase="FALSE" _COMMENT="      ****4"/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%dupcount%"/>
<VARIABLE SET STRING Option="\x00" Destination="%ProcessNames[%sortindex2%]%" NoEmbeddedVars="FALSE"/>
<END IF _COMMENT="                                                                                                                                                 ****4"/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%sortindex2%"/>
<END REPEAT/>
<END IF _COMMENT="                                                                                                 ****1"/>
<END REPEAT/>
<COMMENT Value=" "/>
<COMMENT Value="Testing skip counting and removing duplicates *********************************************" _ENABLED="FALSE"/>
<END IF _ENABLED="FALSE"/>
<COMMENT Value=" "/>
<COMMENT Value=" "/>
<COMMENT Value=" "/>
<COMMENT Value="Pull process names out of array, stack into %Display% with CRLF appended to each "/>
<GET ARRAY LENGTH Array="%ProcessNames%" Dest="%arraylength%"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%index1%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%processcounter%" Value="0"/>
<VARIABLE SET STRING Option="\x00" Destination="%display%" NoEmbeddedVars="FALSE"/>
<REPEAT START Start="1" Step="1" Count="%arraylength%" Save="FALSE"/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%index1%"/>
<IF VARIABLE Variable="%ProcessNames[%index1%]%" Condition="\x01" IgnoreCase="FALSE"/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%processcounter%"/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%display%" Variable="%ProcessNames[%index1%]%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x07" Destination="%display%" Variable="%T[98]%" NoEmbeddedVars="FALSE"/>
<END IF/>
<END REPEAT/>
<COMMENT Value=" "/>
<TEXT BOX DISPLAY Title="List of running processes" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang1033\\f0\\fs20 Number of processes: %processcounter%\r\n\\par \\f1 %\\f0 display\\f1 %\r\n\\par }\r\n" Left="Center" Top="Center" Width="632" Height="703" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<COMMENT Value=" "/>
<COMMENT Value="Restore variables used by this macro" _ENABLED="FALSE"/>
<VARIABLE SET STRING Option="\x0B" Destination="%T[1]%" Value="WIN_DISPLAY_SAVE_T1" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/>
<VARIABLE SET STRING Option="\x0B" Destination="%T[2]%" Value="WIN_DISPLAY_SAVE_T2" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/>
<VARIABLE SET STRING Option="\x0B" Destination="%T[98]%" Value="WIN_DISPLAY_SAVE_T98" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/>
<VARIABLE SET STRING Option="\x0B" Destination="%T[99]%" Value="WIN_DISPLAY_SAVE_T99" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/>
<COMMENT Value=" "/>
<COMMENT Value="Done - exit"/>
<MACRO RETURN/>
<UNLOCK PLAYER _ENABLED="FALSE"/>
`````

Link to comment
Share on other sites

I made other comments, but they did not get posted, because I did not realise I was no longer logged in.

 

I was able to close the Firefox Window with 'Window Close - Firefox'

but that left the Library open; THAT can be killed by ALT F4,

so there is no need for your extensive macro.

 

It's finally working as I hoped for a long time that it might.

 

Once again many thanks for your patience and forebearance.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...