Floating Window - Screen Capture (ImageMagick)

I'm seeing the same behavior that @troy is, i.e. the window is not resizable (and is also much smaller than the window screenshotted and has wide borders on the sides, as you can see here):

I'm running KM 8.0.3 on High Sierra 12.13.0, and installed IM via Homebrew just today.

I Tried MacPorts and it failed saying dCode was not installed correctly.
I re-installed dCode, then installed ImageMagick via Homebrew with no errors.
I changed this 'pref' in the macro:
** Set Variable “scfs_resize” to Text “YES” **

See included screenshot showing the floating screenshot just taken of the browser.

KM 8.0.3
OS X 10.12.6

I’m afraid I’m still not sure from your response if this solved the lack of resizability for you. Did it? On my machine, I made sure scfs_resize was being set to YES and it didn’t seem to change anything when I tested the macro again.

** Setting Variable “scfs_resize” to Text “YES” **
Did not make the floating screenshot resizable.
Sorry for my unclear post :pensive:

No worries. Thanks for clarifying!

  • You:

  • ImageMagick c/o Homebrew

  • KM 8.0.3

  • OS X 10.12.6 macOS Sierra

  • Me:

  • ImageMagick c/o MacPorts 2.4.2

  • KM 7.31

  • OS X 10.10.5 Yosemite

  • Good things:

  • The macro is working but some adjustments are needed for window size depending of the configurations... I can't test.

  • Automatic ImageMagick path behave as expected.

  • Resizing of image file vs. resizing of window
    Resize for ImageMagick is about number of pixels along a side of an image.
    So


    will just lead to a image file with 25% of pixels (50%*50%) but with the same size of the floating window except the lost in accuracy...

  • What I suggest for happy users running KM8 (but unfortunately test myself at this moment)

  1. To be on the safe side, duplicate this KM 7 Action and disable one as backup:
  2. Copy in clipboard the HTML/JS code.
  3. Create a brand new KM8 Custom HTML Prompt
  4. Past clipboard in the HTML field
  5. Delete old KM7 Custom HTML Prompt
  6. Test and let me know...

Hi Gabe,

As you have similar configuration I suggest the same procedure suggested to Troy … or to wait for his results :wink:

I’m not clear, sorry.

“Duplicate this KM 7 Action” - I don’t see anything to download other than the .jpg and I’m running KM 8 - I’m confused.

Thank you for clarifying image size vs. resizing of window. -

Perhaps I am not myself clear enough... Let me try again :wink:

  • In Keyboard Maestro Editor select the "Screen Capture - Floating Screenshot (via ImageMagick)" macro
  • In this macro select the unique "Custom HTML Prompt" action
  • D to duplicate this action
  • etc

Cheers,
alain

I selected
the "Screen Capture - Floating Screenshot (via ImageMagick)" macro
I then selected:
the unique "Custom Floating HTML Prompt" action
Copied it's content to the clipboard.
Created a new macro with a "Custom HTML Prompt" action
Pasted the clipboard
triggered the macro.
I get the same size (small) blank, non-resizable window.
That I got when I ran the full macro.
Hope that helps

  • Duplicate in place this action using ⌘D <= You need this
  • Disable one of these clone <= You need this

The text of the "Custom Floating HTML Prompt" action must be:

<html>
<head>

<script>
	document.write('<title>'+window.KeyboardMaestro.GetVariable( 'scfs_info' )+'</title>');
</script>

<script>
function KMWindow() {
	return window.KeyboardMaestro.GetVariable( 'scfs_dim' )
	}
</script>

<style>
html { 
	background:  no-repeat center center fixed; 
 	-webkit-background-size: contain;
 	margin: 0;
	padding: 0;
}

body {
	margin: 0;
	padding: 0;
}
</style>
</head>

<body>
&nbsp;

<script>
	document.documentElement.style.backgroundImage = "url('" + KeyboardMaestro.GetVariable( 'scfs_file' ) + "?" + Date.now() + "')";
</script>
</body>
</html>

You don't have to create a new macro :frowning:

  • Just create a new KM8 action "Custom Floating HTML Prompt in place with the previous text in its text field

  • Then you have to delete the old KM7 "Custom HTML Prompt" action (the one not disable)

Much more difficult to write than to do...

You have just substitued a new fresh KM8 "Custom HTML Prompt" action to the old KM7 one :grinning:

@alain

It seems you are using the locate program to get the location of identify.

I don’t think this is a good idea. For example on my Mac there is no locate database. Hence the Shell Script action with the locate program spits out a several-lines-long warning text — instead of a valid path! That string is than used in the subsequent Shell Script action, which will gloriously fail, of course. (At least you should set that action to “abort/notify on failure”, or, better, make a sanity check for the output of locate.)

It is possible that the other users have the same problem. (?)

You — and any user of your macro — can set the paths for shell programs in KM’s ENV_PATH variable. The variable should contain — amongst others — /usr/local/bin, which is the default path for Homebrew-installed tools, and probably MacPorts, too.

See this KM Wiki article for how to set the paths in KM.

2 Likes

I inserted a ‘new’ Custom Prompt with HTML text action into the macro.
Copied your text above into it, and disabled the original ‘Prompt’ step.
and - I get the same small, un-resizeable window.

Custom HTML Prompt windows can be resizable in Keyboard Maestro version 8 if you turn on the option in the action.

1 Like

Thank you @Tom for pointing weakness using locate to find ImageMagick installation path with a simpler and better solution.

Here the default path for MacPorts is /opt/local/bin :wink:

Although my goal was not to design a bullet proof auto-install macro, without the necessary means to test with many software/hardware configurations, I will switch to KM's ENV_PATH variable method in the next version.

If you agree I need one more test in your own environment:

  • Run the Terminal and send me back the screen shot of the (ImageMagick) command:
    identify -format "%w,%h" an_existing_image_file

Cheers

No problem, here a proposal for ENV_PATH:

/usr/local/bin:/opt/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin

Paths at the beginning have preference over the later paths. So the important thing is to have the paths where the system's default tools are installed (/usr/bin, /bin, etc.) towards the end. Otherwise your custom tools (i.e. the ones installed by Homebrew/MacPorts) will not be used.

The above is just an example, there might be better solutions. At the end it’s a decision of the user. For example if — for any reason — you are installing the same programs with Homebrew and with MacPorts you have to decide which ones to give preference to.

1 Like

I tried your earlier suggestion to @troy to essentially recreate the Custom HTML Prompt in KM8, but it only resulted in an identical action. However, once I followed @peternlewis’s tip about making sure the “Resizable” option in the prompt’s gearbox menu was checked, the action, and subsequently the macro itself, worked as I expected. I don’t know how you made sure the prompt window was resizable in KM7, but perhaps the resizable option gets un-checked going from KM7 to KM8? Either way, at least it seems to have turned out to be an easy fix :slightly_smiling_face:

1 Like

@peternlewis yeah, that would do it. :relaxed:
thanx

New version 1.2: OP updated

1 Like