Can some please explain to me how to build a form and have KM use it?
So this is what I would like to happen.
Example: I am using a ticketing software. I want to use a macro that will bring up a form. I will then fill out the form. When I click (OK) it will paste the results into whatever window I had open.
If this was the textbox:
First Name: (Input field)
When it pasted I would want it to say:
First Name: James
I am thinking I would like the form to be HTML because then I could build it out in Dreamweaver or another html editor. I would like KM to use the file and paste the results into the selected window (or last selected window).
Any advise on how to complete such task would be greatly appreciated. I am good with theories. But if someone could build this macro and paste the macro here. I can then look to see how you completed it, then I will understand and be able to go ahead and build one myself.
The main KM form is a simple form. It’s called "Prompt For User Input"
See this KM Wiki article:
Prompt For User Input
There is a Custom HTML Prompt. See:
Custom HTML Prompt Action
It’s pretty cool, but much more complex and difficult to setup. So unless you really need that level of customization, the first form is a better choice.
If you have any follow-on questions, let us know.
This is going to be a complex form. That is why I would like to use the Custom HTML Prompt Action. But I tried and I do not really understand it.
How would I create a form and get KM to use it with Custom HTML Prompt Actions?
Did you read the wiki article I gave you above?
It provides complete instructions, including an example macro.
I did. It provides
(Demo Using KM Custom HTML Prompt with AppleScript & JXA in the Forum)
Do I really need to use Applescript and JXA for this to work? Either way it provides enough that I could do trial and error for a while till I understand it all.
All I was hoping for was a simple macro that would bring up an html form. Then when you click submit it spits out the results in what ever window you had in focus.
Again, I can figure all this out with the “example” just would of been more simple if I had a basic html form that already worked in KM that I could of reviewed.
Ok, There was one demo I did not see. So I imported the “Keyboard Maestro Form Example Testing” It looks to be what I want. The only thing it is missing or I dont know how to get working is when you click OK I would like it to past the results as the following
And so on. Could you explain how I could get that to work?
From the wiki article:
To set initial values, set the KM variables before you execute the Action, and then the KM variables are updated with the user’s changes when the user clicks OK.
EDIT: Fri, Feb 19, 2016 -- Correct error about checkbox
The normal Prompt for User Input forum can do most of what the HTML Prompt can do, including checkboxes.
But the Prompt for User Input form cannot do:
- A true set of Radio buttons
• Can only offer choices of "A|B|C"
• Cannot show a list of choices, or allow multiple selections.
- Text Block
• Allow only one line of text to show or be entered.
- So if you need a dynamic form, then you will need to use the Custom HTML Prompt.
Here is a comparison:
####Custom HTML Prompt Example
####Prompt for User Input Example
###OUTPUT THE RESULTS
You would use the same Actions to output the results from either form:
###Here are the Actions:
So by complex this is what I mean.
The form that I am trying to build has 3 options depending on the option you choose it will give you more options and within those options it might then ask for even more.
Example: Let’s say it is a ticket…
When they select person one (radio box) more options would show up. So it is more of a dynamic form.
The output will only be what they had to fill out.
One might ask why do this inside KM. I want it inside KM because it would be part of another ticketing software. This would acted more like a template for them to feel out that will then be pasted inside the ticket when they click submit. I know building it inside HTML is very possible for me to do what I want.
Currently we already have it inside HTML (sorry can’t disclose what that looks like) but it is a site they open and fill it out. When they click submit it opens another window with the results that then needs to be copy and pasted inside the ticket.
Another reason I would like this inside HTML is because then I could have a lot of people using KM and if I need to update the form I could do so without the need of going to each computer or pushing out a new macro.
Thanks for clarifying that requirement.
In that case, the Custom HTML Prompt is the only choice that will work.
Prompt For User Input can do a checkbox (and popup menus for a single selection from options).
It cannot do radio buttons or text areas or anything dynamic.
Thanks for the correction Peter.
I knew that, but somehow another I forgot it.
I’ll update my post when I get back to my mac.
Would you have time to create a form in HTML that does everything I want?
- You click a keybinding
— The form will be very basic so there is less coding
- Two radio buttons
– Select one and it will bring a text box into view
— What it says does not matter
– Put something in the text box
– Click submit and it paste the output into the current select application (like notes or anything)
To be honest, I am lost on how this should function even with the examples. Since the examples are not 100% what I am looking for. I am still very new to KM so any and all help you been giving me is very much appreciated.
I wanted to let you know I am working on this when I have time. Please give me a couple weeks to mock something up then I will provide it to you. I know we are all very busy and appreciate you helping with this.
No need to rush on my account. I’ll be here, and plenty of active projects.
Ok after much trial and error… I think what would work best for this is keeping what we currently use but my question is>>
Is there anyway to program a submit button on a site (HTML) to trigger a macro?
On a web page in a browser? You can possibly use kmtrigger: URL scheme:
You can trigger a macro using the kmtrigger: scheme with a URL like kmtrigger://macro=MacroName&value=Value (the value is accessible via the %TriggerValue% Text Token).
I’m not sure the web browser will allow that though.