GaryENNE Posted October 12, 2022 Report Share Posted October 12, 2022 Hi all, I've been using Prompt for Value to setup variables for years now and it was only a single line item. Ie: I type a value and press enter, it'll be the same as clicking 'Ok' button. After updating to MEP V.6.4.0.1, it appears the Prompt for Value accepts multi-line items. Ie: I type a value and press enter, it'll go to the next line rather than enter / 'OK' Button. Now I have to tab and then enter after typing in the value. This is a welcome change but at the same time, is there a way to revert via a setting/configuration? Thank you in advance. 1 Quote Link to comment Share on other sites More sharing options...
acantor Posted October 13, 2022 Report Share Posted October 13, 2022 I don't think there's a built-in way to revert to the older way. However, here's a kludge. Create a second macro with activation of window title gaining focus. The window title you're looking for is "Enter String Value" (exact match). Here's the script for the second macro. It's active while the "Enter String Value" window is open. The second macro waits for you to press "Enter". Then it sends Tab Enter. Wait for Key Press: ENTER Text Type (Simulate Keystrokes): <TAB><ENTER> Quote Link to comment Share on other sites More sharing options...
stevecasper Posted October 13, 2022 Report Share Posted October 13, 2022 9 hours ago, acantor said: I don't think there's a built-in way to revert to the older way. However, here's a kludge. Create a second macro with activation of window title gaining focus. The window title you're looking for is "Enter String Value" (exact match). Here's the script for the second macro. It's active while the "Enter String Value" window is open. The second macro waits for you to press "Enter". Then it sends Tab Enter. Wait for Key Press: ENTER Text Type (Simulate Keystrokes): <TAB><ENTER> Hey Acantor, Thanks for the work-around, though I am running into a problem with it that doesn't seem to make sense. I've built the 2nd macro and it runs fine when the Enter String Value prompt pops up. I enter my prompted value and press enter, the prompt goes away, but the first macro just sits there until I press Enter again. It's like the 2nd macro is running twice. What's worse is that it ends up adding a bunch of carriage returns into the text editor (notepad++, if that matters) when it pastes the info over. Here's my code so you (or anybody else) can tell me what I'm doing wrong. Primary Macro <VARIABLE SET STRING Option="\x01" Destination="%T[1]%" Prompt="What is the customer's name?" Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0"/> <MACRO RUN Use_ID="FALSE" Name="Enter String Value feature fix" ID="-1" Wait="TRUE"/> <VARIABLE SET STRING Option="\x01" Destination="%T[2]%" Prompt="What is the Service Request Number?" Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0"/> <MACRO RUN Use_ID="FALSE" Name="Enter String Value feature fix" ID="-1" Wait="TRUE"/> <TEXT TYPE Action="1" Text="Hello %T[1]%, \r\n\r\nI just wanted to follow up with you on service request: %T[2]%. I haven’t heard from you since my last correspondence and I wanted to see if you wish to continue working on this issue. Please contact me at your soonest convenience by replying to this email. I look forward to working with you towards a resolution on this service request. \r\n\r\nThanks,"/> Secondary "fix" Macro <WAIT FOR KEY PRESS Key="ENTER" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="<TAB><ENTER>"/> This new bug feature is going to mess with my work-flow (I use a lot of templates that prompt for values). It will probably be faster and easier for me to just learn to Tab-Enter (or Tab-Space, more likely) by default rather than track down every macro I have that uses a variable prompt and add in this extra Macro Run command. Hopefully Insight is paying attention and pushes an update that either reverts this or makes the 'multiple lines' feature optional. I'd be okay with a "ctrl+enter = OK" solution like so many other applications support. Thanks for anything you might be able to add to this. Steve Quote Link to comment Share on other sites More sharing options...
acantor Posted October 13, 2022 Report Share Posted October 13, 2022 39 minutes ago, stevecasper said: It will probably be faster and easier for me to just learn to Tab-Enter (or Tab-Space, more likely) by default Hi Steve, Consider my workaround, and variations of it, as a last-ditch effort. It can fail in many ways, as you have already noted. Re-learning to press a two-key sequence is probably the most elegant solution. But don't overlook the possibility of filing a feature request with ISS. I have found them very responsive to input from Macro Express users. Quote Link to comment Share on other sites More sharing options...
rberq Posted October 13, 2022 Report Share Posted October 13, 2022 I have a macro similar to what acantor suggested. Try changing it as shown below. Wait for Key Press: ENTER Text Type (Simulate Keystrokes): <TAB> Delay: 250 milliseconds // delay so ENTER will not happen until tab selection happens Text Type (Simulate Keystrokes): <ENTER> No guarantees -- but the delay fixed my problem with a multiple-choice menu. Since this short macro is interacting (indirectly, via the "keyboard") with the PROMPT macro, the TAB and ENTER keystrokes may need to be separated slightly in time, so the PROMPT macro has time to respond. Quote Link to comment Share on other sites More sharing options...
rberq Posted October 13, 2022 Report Share Posted October 13, 2022 1 hour ago, stevecasper said: rather than track down every macro I have that uses a variable prompt and add in this extra Macro Run command. Hmmm... That is the problem. You do NOT NOT NOT want a Macro Run command to execute acantor's macro or my variation on his macro. Re-read acantor's suggestion. The "fix" macro is triggered automatically by the appearance of the PROMPT window, named "Enter String Value" (exact match). You specify that in the Activations tab of the script editor. 1 Quote Link to comment Share on other sites More sharing options...
stevecasper Posted October 13, 2022 Report Share Posted October 13, 2022 56 minutes ago, rberq said: Hmmm... That is the problem. You do NOT NOT NOT want a Macro Run command to execute acantor's macro or my variation on his macro. Re-read acantor's suggestion. The "fix" macro is triggered automatically by the appearance of the PROMPT window, named "Enter String Value" (exact match). You specify that in the Activations tab of the script editor. OooooOOOooOOoo That was my problem. I was running the 'fix' from the primary, but it was also being activated 'naturally' by the prompt window itself. I pulled the Macro Run commands out of the primary, and that fixed Problem 1. Problem 2 (extra carriage returns) I resolved by prepending a <BACKSPACE> to the <TAB><ENTER> (the troublesome carriage returns were being generated by me hitting Enter to allow the 'fix' to proceed. Problem 3 (new problem introduced by the fix) was fixed by adding a delay between the first and 2nd prompts. Working Primary <VARIABLE SET STRING Option="\x01" Destination="%T[1]%" Prompt="What is the customer's name?" Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0"/> <DELAY Flags="\x01" Time="0.25"/> <VARIABLE SET STRING Option="\x01" Destination="%T[2]%" Prompt="What is the Service Request Number?" Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0"/> <TEXT TYPE Action="1" Text="Hello %T[1]%, \r\n\r\nI just wanted to follow up with you on service request: %T[2]%. I haven’t heard from you since my last correspondence and I wanted to see if you wish to continue working on this issue. Please contact me at your soonest convenience by replying to this email. I look forward to working with you towards a resolution on this service request. \r\n\r\nThanks,"/> Updated 'fix' <WAIT FOR KEY PRESS Key="ENTER" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="<BACKSPACE><TAB><ENTER>"/> Quote Link to comment Share on other sites More sharing options...
stevecasper Posted October 13, 2022 Report Share Posted October 13, 2022 1 hour ago, acantor said: Hi Steve, Consider my workaround, and variations of it, as a last-ditch effort. It can fail in many ways, as you have already noted. Re-learning to press a two-key sequence is probably the most elegant solution. But don't overlook the possibility of filing a feature request with ISS. I have found them very responsive to input from Macro Express users. To be honest, this gave me motivation to streamline my process anyway. I have a bunch of macros that act as Multiple Clipboards. Certain info is always hooked to specific clipboards. I have been meaning to start hanging customer names to one, but have been too lazy. I always have SR numbers on a hook, so this issue gave me a good reason to update some of my macros that relied unnecessarily on prompts. i.e. for this macro, I always ran the paste macro to enter the SR number into the prompt... so I was already wasting effort But I will take your suggestion to heart. I'll reach out to ISS through the feature request/bug report process and hope others do the same. I don't dislike the new function, but I can't imagine we're the only ones who have been impacted and had to make our processes more complicated to adjust to it. Thank you for your fix! Quote Link to comment Share on other sites More sharing options...
acantor Posted October 13, 2022 Report Share Posted October 13, 2022 19 minutes ago, stevecasper said: Thank you for your fix! This forum has always been a good place to learn about other members' interesting and curious fixes! Quote Link to comment Share on other sites More sharing options...
GaryENNE Posted October 13, 2022 Author Report Share Posted October 13, 2022 Thank you for all the suggestions: @acantor @stevecasper @rberq. I agree, I'll also reach out to ISS. Quote Link to comment Share on other sites More sharing options...
acantor Posted October 14, 2022 Report Share Posted October 14, 2022 I thought of another workaround. It also involves two macros: The main macro waits for you to input something, maybe something like this: Variable Set String %x%: Prompt Text Box Display: Value of x Create a second macro with hotkey activation. Select "Enter" as the hotkey. Set its scope to "Enter String Value" (exact match). When the "Enter String Value" window is open, pressing Enter triggers the second macro. The problem is that we don't know what is focused when we press Enter: the text field, the OK button, or the Cancel button. This version seems to work reliably: if the OK button has focus, pressing Enter activates the OK button. If the Cancel button has focus, pressing Enter activates the Cancel button (which cancels the operation). Otherwise, the second macro assumes the text field has focus, and presses Tab Space. Capture Control from Focused Control into %DialogBoxControl% Get Control Text from %DialogBoxControl% into %Text% If Variable %Text% Equals "OK" Text Type (Simulate Keystrokes): <SPACE> Macro Stop End If If Variable %Text% Equals "Cancel" Text Type (Simulate Keystrokes): <SPACE> Macro Stop End If Text Type (Simulate Keystrokes): <TAB><SPACE> Quote Link to comment Share on other sites More sharing options...
rberq Posted October 14, 2022 Report Share Posted October 14, 2022 1 hour ago, acantor said: I thought of another workaround. It also involves two macros: Clever, and it should run really fast. I should keep looking for opportunities to use controls, so I can learn more about them. I always forget to consider them when coding macros. Would it work, to change the last line of your macro (Text Type (Simulate Keystrokes): <TAB><SPACE>) to find and set focus to the OK button and click on the control? (Yeah, I know, I should take this opportunity to learn by figuring it out for myself -- but lunch calls.😋) Quote Link to comment Share on other sites More sharing options...
acantor Posted October 14, 2022 Report Share Posted October 14, 2022 Lunch is important! There are probably better ways to handle the situation via controls. I just wanted to see if I could build a proof-of-concept. My initial idea was to "repeat until" the control text or the control class matched a certain value. But I try to avoid repeats that might turn into infinite loops, unless I can incorporate a "failsafe." There is a built-in failsafe. With only three controls on the screen, there should be no reason to check controls more than three times. But rather than repeat three times, I opted for two IF statements. There might be an issue sending <TAB><SPACE> if the Cancel button happens to be focused. Focus will go to the text field, and the macro will add a space to whatever is in the field. Rather than complicated workarounds, I would prefer an option in Macro Express to accept carriage returns in the field, or to cause Enter to activate the OK button. On the other hand, I find these kinds of workarounds entertaining! Quote Link to comment Share on other sites More sharing options...
GaryENNE Posted October 24, 2022 Author Report Share Posted October 24, 2022 This worked flawlessly! I also added another macro where ESC button on Enter String Value to stop macro (that was changed as well with the new update). Quote Link to comment Share on other sites More sharing options...
acantor Posted October 24, 2022 Report Share Posted October 24, 2022 Quote Link to comment Share on other sites More sharing options...
JoSp Posted November 4, 2022 Report Share Posted November 4, 2022 How did you do this? Using stop macro only stops the second macro? Quote Link to comment Share on other sites More sharing options...
JoSp Posted November 4, 2022 Report Share Posted November 4, 2022 Fixed this using the 'Mouse to tray icon' and right click functions. A little side note: these extra macro's only work when you do not use 'Lock Player' (which Macro Express adds by default when you upgrade/import older macros) Quote Link to comment Share on other sites More sharing options...
Cartwheels Posted November 11, 2022 Report Share Posted November 11, 2022 I noticed this the other day. It kind of threw me off at first. We need this choice! The one with the blue check mark on the picture below. Quote Link to comment Share on other sites More sharing options...
acantor Posted January 9, 2023 Report Share Posted January 9, 2023 Message added by mistake Quote Link to comment Share on other sites More sharing options...
GaryENNE Posted January 10, 2023 Author Report Share Posted January 10, 2023 Hey all, wanted to provide an update from the Devs: "We have made a change to the Variable Set String from Prompt command in Macro Express Pro. This change allows you to select "Single line" or "Multiple lines". When "Single line" is selected pressing the Enter key will accept the input and close the dialog. This change will be available in the next released version of Macro Express Pro. " 👍 For devs!!! Quote Link to comment Share on other sites More sharing options...
Cartwheels Posted February 18, 2023 Report Share Posted February 18, 2023 I just notice this update came out and works well! More👍for the devs!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.