Jump to content
Macro Express Forums

Scoping a window that's 'under JavaScript'?


Recommended Posts

Is it possible to scope a macro when the target is 'running under javascript'?

 

As an example, when I'm using Street View in Google Maps with Firefox and I switch to full screen mode, the only way I've found to activate a macro is to keep it global. I think the reason is that javascript has taken over at this point.

 

If so, I wonder if maybe an AutoIt script could get around this?

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

This worked for me:

  1. Launched Firefox and brought up Google Maps.
  2. Created new macro
  3. Gave it HotKey activation of Win+Ctrl+s
  4. Clicked Scope tab
  5. Chose "Window/Program Specific"
  6. Clicked Add Window
  7. Chose "Google Maps - Firefox" from the list displayed
  8. Changed to "Google Maps -"
  9. Entered the following macro:

If Not Window "Google Maps -" is focused
 Macro Stop
End If
Text Box Display: Google Maps is running

Link to comment
Share on other sites

Thanks Samrae, but that simple approach doesn't work for me. Did you test the key requirement described in my original post, namely that it should be activated when GM is in Street View and Full Screen?

 

Perhaps I should have repeated that in my follow-up to Paul...

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Then something like this might work:

Variable Set Integer %ScnWidth%: Set to the Screen Width
Variable Set Integer %ScnHeight%: Set to the Screen Height
Variable Set Integer %CurWinWidth%: Set to the Current Window's Width
Variable Set Integer %CurWinHeight%: Set to the Current Window's Height

// See if the app is maximized
If Variable %CurWinWidth% Does not Equal "%ScnWidth%"
 And
If Variable %CurWinHeight% Does not Equal "%ScnHeight%"
 Text Type (Simulate Keystrokes): <WIND><CTRLD>s<CTRLU><WINU> // Send Win+Ctrl+s in case another application needs it
 Wait for Text Playback
 Macro Stop
End If

If Not Window "Google Maps -" is focused
 Macro Stop
End If
Text Box Display: Google Maps is running

I did not test this. You may have to adjust the comparisons between %ScnWidth% with %CurWinWidth% and %ScnHeight% with %CurWinHeight% to account for borders.

Link to comment
Share on other sites

Thanks Samrae, appreciate your efforts. I've worked around the issue in a rather simpler way. Some brief background: the ultimate objective was to capture and save screenshots of a certain size and aspect ratio from either Google Earth (GE) or Google Maps (GM). In both cases these apps were in their Street View mode and Full Screen. I found that GM cannot be activated by any ME Pro macro while it is in that mode, unless the macro's scope is set to global. So, with hundreds of hotkey-activated macros, that reduced my flexibility.

 

My approach is to use this macro

Screenshot GE/GM (16:9)

Variable Set String WindowTitle to topmost window title
If Variable %WindowTitle% Equals "Google Earth"
 Macro Run: Screenshot GE - fixed size
Else
// If title is NOT Google Earth, assume it is GM in full screen Street View.
 Macro Run: Screenshot GM from full screen
End If

 

It's activated by Win+Ctrl+s.

 

Screenshot GE - fixed size is scoped to GE.

 

Screenshot GM from full screen is globally scoped.

 

I have no other macros activated by Win+Ctrl+s.

 

Note: When any macro operates on GM in that mode, it has the immediate result of switching it out of full screen mode (but staying in SV).

 

--------------------

BTW, am I right that to preview a post it's now necessary to go through an extra stage to bring up the Preview button? If so, seems a backward step IMO!

 

 

--

Terry, East Grinstead, UK

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...
×
×
  • Create New...