Hi Gabe,
As you have similar configuration I suggest the same procedure suggested to Troy … or to wait for his results
Hi Gabe,
As you have similar configuration I suggest the same procedure suggested to Troy … or to wait for his results
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
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
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>
<script>
document.documentElement.style.backgroundImage = "url('" + KeyboardMaestro.GetVariable( 'scfs_file' ) + "?" + Date.now() + "')";
</script>
</body>
</html>
You don't have to create a new macro
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
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.
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.
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
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:
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.
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
@peternlewis yeah, that would do it.
thanx
New version 1.2: OP updated
Hi,
I have a question about how to use this macro.
Is it by design that the newly created screenshot will be moved to trash. If we want to use it, we will need to go to trash to retrieve it?
This is kind of a surprising "feature", as we normally would expect the screenshots to be saved to some other folders. Maybe I misunderstood something here?
The main purpose is to create a screenshot in the size we want and keep it in small size, correct? I would like to add options to
I probably would be able to add these options myself, but I want to fully understand what this macro is designed to do.
Thanks!
I have another question:
The above action will output the variable value of scfs_retina
as:
But the following action use a condition like this:
How can the variable contain Retina: Yes
?
Hey Martin,
It doesn't. Why do you need it to?
On my Non-Retina Mid-2012 MacBook Air “Retina” is not produced at all by your shell script. It produces a null.
So as far as I can see you only need to test for contains Retina
.
If you really want the script to produce “Retina: Yes” you'll have to write your own conditional in your shell script.
-Chris
Hi Chris,
That's why I asked that question.
I was implying that the macro needs revision. Years ago it may return "Retina: Yes", but at least it's not returning "Retina: Yes" anymore. This means, the condition action in the macro of OP will always go to the "otherwise" section.
Ah, so.
I don't think the brevity of this question meets your objective. Please be more direct and reference previous work if/when it adds clarity.
No one is likely to read a long thread to discover the referenced action is from the OP rather than you.
Myself included (obviously)...
@alain hasn't been seen on the forum since Jul 15, 2018, so if you want to modify the macro you'll have to do it yourself.
Holler if you need help.
-Chris
Hi Chris,
You’re right on.
I made many assumptions. I assumed people would follow what i was saying or even implying. I assumed the author would see my posts and respond to my questions. But I forgot there are at least quite a few folks here are ready to respond and would not be able to understand if I don’t say it in a straight forward way and provide necessary background information. Thanks for being patient with me and kindly pointing out the problems in my posts.