Jump to content
Macro Express Forums

MakaPakaTobyHannah

Members
  • Posts

    45
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    London

Recent Profile Visitors

382 profile views

MakaPakaTobyHannah's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I played with this a bit and came up with a slightly different approach. Kunkel321’s approach didn’t work because it stayed in an infinite loop. Also, I haven’t inspected this, but I think in theory it’s possible that prevLine = currLine, and this appears somewhere within the script (not just at the end). In that case, the process would abort. So I thought, let’s start by copying the entire script to the clipboard. Assign that to a variable. Then, count all carriage returns and line feeds. That will tell you how many lines there actually are in the script. Use that counter variable for set a repeat loop. When the repeat loop is done, you’re at the end of the script. I have tested this now, and it works just fine on my system. Definitely NOT sexy! I would think it would be better to modify the script code directly for the color coding, rather than navigating through menus. I didn’t attempt that (yet). I did notice that, because the script contained variable definitions (apparently), the "trim" command failed, as apparently the script attempt to locate those variables. So I opted for replacing all % signs with PLACEHOLDER to circumvent that problem. Perhaps someone here can enlighten me how to deal with that issue (it’s come up for me before). Anyway, here is my script now; would love to know if it works for you. This is just set up at the moment to highlight text boxes dark blue background, bright yellow text font. Here it is: <VARIABLE SET TO ASCII CHAR Value="13" Destination="%T13%" _COMMENT="assign carriage return to %T13%"/> <VARIABLE SET TO ASCII CHAR Value="10" Destination="%T10%" _COMMENT="assign line feed to %T10%"/> <VARIABLE SET STRING Option="\x00" Destination="%CRLF%" Value="%T13%%T10%" NoEmbeddedVars="FALSE"/> <KEYSTROKE SPEED Delay="16"/> <TEXT TYPE Action="0" Text="<CONTROL>a"/> <CLIPBOARD COPY/> <VARIABLE SET STRING Option="\x02" Destination="%scriptToClipboard%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%scriptToClipboard%" ToReplace="%" ReplaceWith="PLACEHOLDER" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x00" Destination="%scriptToClipboard%"/> <REPEAT UNTIL Variable="%scriptToClipboard%" Condition="\x07" Value="%CRLF%"/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%scriptToClipboard%" ToReplace="%CRLF%" ReplaceWith="BunnyRabbit" All="FALSE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%counter%"/> <END REPEAT/> <VARIABLE MODIFY INTEGER Option="\x01" Destination="%counter%" Value1="%counter%" Value2="2"/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%scriptToClipboard%" ToReplace="BunnyRabbit" ReplaceWith="BunnyRabbit%CRLF%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <TEXT BOX DISPLAY Title="This is the complete script" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 There are %counter% lines\\f1 \r\n\\par %scriptToClipboard%\r\n\\par }\r\n" Left="Left" Top="Center" Width="1921" Height="592" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <TEXT TYPE Action="0" Text="<HOME>"/> <CLIPBOARD COPY/> <VARIABLE SET STRING Option="\x02" Destination="%x%" NoEmbeddedVars="FALSE"/> <IF VARIABLE Variable="%x%" Condition="\x06" Value="<TEXT BOX DISPLAY" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="This line is a text box!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <TEXT TYPE Action="0" Text="<ALT>e"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<END>"/> <REPEAT START Start="1" Step="1" Count="6" Save="FALSE"/> <TEXT TYPE Action="0" Text="<ARROW UP>"/> <END REPEAT/> <TEXT TYPE Action="0" Text="<ENTER>"/> <WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="<HOME><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW DOWN><ARROW DOWN><ARROW DOWN><SPACE><ENTER>"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<ALT>e"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<END>"/> <REPEAT START Start="1" Step="1" Count="7" Save="FALSE"/> <TEXT TYPE Action="0" Text="<ARROW UP>"/> <END REPEAT/> <TEXT TYPE Action="0" Text="<ENTER>"/> <WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="<HOME><ARROW RIGHT><ARROW DOWN><SPACE><ENTER>"/> <END IF/> <REPEAT START Start="1" Step="1" Count="%counter%" Save="FALSE"/> <TEXT TYPE Action="0" Text="<ARROW DOWN>"/> <CLIPBOARD COPY/> <VARIABLE SET STRING Option="\x02" Destination="%x%" NoEmbeddedVars="FALSE"/> <IF VARIABLE Variable="%x%" Condition="\x06" Value="<TEXT BOX DISPLAY" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="This line is a text box!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <TEXT TYPE Action="0" Text="<ALT>e"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<END>"/> <REPEAT START Start="1" Step="1" Count="6" Save="FALSE"/> <TEXT TYPE Action="0" Text="<ARROW UP>"/> <END REPEAT/> <TEXT TYPE Action="0" Text="<ENTER>"/> <WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="<HOME><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW DOWN><ARROW DOWN><ARROW DOWN><SPACE><ENTER>"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<ALT>e"/> <DELAY Flags="\x02" Time="100"/> <TEXT TYPE Action="0" Text="<END>"/> <REPEAT START Start="1" Step="1" Count="7" Save="FALSE"/> <TEXT TYPE Action="0" Text="<ARROW UP>"/> <END REPEAT/> <TEXT TYPE Action="0" Text="<ENTER>"/> <WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="<HOME><ARROW RIGHT><ARROW DOWN><SPACE><ENTER>"/> <END IF/> <END REPEAT/> <TEXT BOX DISPLAY Title="Done" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 Finished!\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="181" Height="112" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <MACRO STOP/> <COMMENT Value="Stuff below this kept here for reference."/> <CLIPBOARD COPY/> <DELAY Flags="\x02" Time="100"/> <VARIABLE SET STRING Option="\x02" Destination="%x%" NoEmbeddedVars="FALSE"/> <COMMENT/> <IF VARIABLE Variable="%x%" Condition="\x06" Value="<TEXT TYPE" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="This line is a Type Text!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <END IF/> <COMMENT/> <IF VARIABLE Variable="%x%" Condition="\x06" Value="<IF VARIABLE" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="This line is an If Variable!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <END IF/> <COMMENT/> <IF VARIABLE Variable="%x%" Condition="\x06" Value="<MESSAGEBOX" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="This line is a Message Box!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <END IF/> <COMMENT/> <IF VARIABLE Variable="%x%" Condition="\x06" Value="<COMMENT" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="This line is a Comment!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <END IF/> <IF VARIABLE Variable="%x%" Condition="\x06" Value="<TEXT BOX DISPLAY" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="This line is a text box!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <END IF/> <COMMENT Value="TEST LINES"/> <COMMENT Value="Check the ability to check the content of an MEP instruction by selecting one of these four lines, then running this macro."/>
  2. I have been away from the computer for several days, but now I really want to thank everybody for this most valuable feedback! Very cool, indeed. 😉
  3. I recently developed an insane script of about 4,000 lines (ca. 80 pages) converting abstruse musical input code into a completely different language. I will make a video of that at some point and post it on YouTube. Anyway: of course, I use text boxes as stops copiously to debug my scripts. I wish there were a preference setting with which to color code certain items; I color code all my text boxes dark blue background, bright yellow text font. Annoying to have to do that individually each time. In a script of 4,000 lines, it is often necessary to activate a bunch of text boxes to find out where the error occurs. When a text box finally displays a faulty message, I know that somewhere before that text box, the error occurs. In a script of thousands of lines, and multiple text boxes displaying, how to you know where that particular text box is located? I have come to put line numbers at the top of all my debugging text boxes. But when the code then changes (additions or deletions), those line numbers are then off. Can you all confirm that, in fact, there is no way to put some kind of integer variable into a text box that identifies the line number of the text box? I think that would be cool to have. Cheers.
  4. Thanks for all the feedback. Anybody written to MacroExpress about this? I will now; I have found them to be very responsive. I think this is a serious limitation, and really wastes a lot of time.
  5. Further to this... a brute force approach. It’s interesting that some "wait for window" calls in this script function 100% reliably; the one activating the main application, however, fails more often than not. I agree, it must be how this application manages window titles. Be that as it may, I removed all calls for activating the main application window. Instead, as the macro is first called from within that application, with a scope set to that application, I use a left mouse click to click on the main application window, where needed. Now, the macro runs flawlessly. Saves a lot of tedious hassle...
  6. Grmpf. Thanks for that response, terrypin. At least I can see that I’m not the only one with this problem. I have never experimented with slowing down the macro, I'll try that now first. Very doubtful.
  7. This particular issue has plagued me for a very long time, and I just cannot figure out what the issue is. I find that "Window Activate" is extremely unreliable. Whenever I develop scripts where, after one thing is done in one window another window must be activated before the macro proceeds, the macro simply hangs. Today’s example. I wish to batch print to PDF all *.musx files in a given directory. For this to work, each *.musx files must first be opened, in turn. I have to: 1) Issue the open command to the first file in the list 2) Wait for the file to open 3) Issue a "print" command within the application (this will call Adobe Acrobat) 4) Wait for the PDF to have been compiled and open within Acrobat 5) Close the newly opened PDF 6) Reactivate the window of the original application 7) Close the file that was opened within that application 8) Continue on to the next file by looping back to step (1) There are various dialog boxes that come up (Open, Print, Save PDF File As). In order for the "open" and "close" commands (sent as keystrokes) within the main application to function properly, the main application must be active. Hence my use of the Window Activate command. I have experimented with "Exact Match," "Partial Match," "Partial Match" with "The name contains wildcards" checked and the use of the asterisk character. I have inserted delays in front and after the Window Activate commands. Sometimes it works, sometimes the macro hangs. Is this a known problem? Again, I have had trouble with this for so long, it’s not even funny. But today, I just cannot get this process to work reliably. I have hundreds of PDFs to compile, and I don’t want to do this manually one file at a time. MORE INFO I just inserted an "If Window is Running" check. I placed the window title precisely; instead of typing it, I populated the field by selecting the window title via "Browse". The "If Window is Running" check is supposed to open a text box saying, the window is running. But that text box doesn’t even come up. In other words, the If function doesn’t see the window, even though it is visible.
  8. Answering my own post... I see that nobody posted a response, or suggestion - which clearly indicated that the issue was specific to my system, which I had suspected anyway. I thought that maybe upgrading to the most recent ME version might solve the problem. It didn’t. I wrote to tech support; they were unaware of an issue as well. For anyone who might encounter this type of thing, this was the culprit in my case. I run three three monitors, and to maximize their usefulness I also run a utility called "Actual Window Manager" (which I love). On reinstalling my operating system and applications, Actual Window Manager installed default settings. I restored my preferences from a settings file I had backed up. But apparently, one crucial setting was not part of that backup. It is a mouse option that activates or deactivates a window on "mouse hover". When the mouse hovers over a window, it is activated. Conversely, if a mouse is moved off a window, it automatically becomes deactivated. I find that feature useless and annoying. Anyway, it was checked, and this caused some ME menu to close instantly, as the mouse pointer was not on top of the menu. Feature turned off, problem solved.
  9. I have had to reinstall my operating system (Windows 10) due to some corruption. I am in the process of reinstalling all my bits and bobs. I have a huge amount of macros for an application I run within DOSBox. For this, I have created an extensive menu structure. I invoke a main menu with a hotkey; from there, I can then select macros directly, or select submenus. This has always worked flawlessly. Now, however, not so much. When I invoke the main menu with the hotkey, and then navigate around in the menu, for instance with arrow keys, or click on a submenu, some of them pop up for an instant, but then close immediately. The upshot is, I cannot select from those menus, because they don’t stay open. I’ve looked around in Macro Express options, but I see nothing there that seems to help. Anybody have any idea what’s happening here??? Adding to this: my preferred "Menu Style" is "Windows Default." I find that if I change the style to "Nickname and Scope" (for instance), then the submenu works just fine: opens up and stays open for me to select from, either by keyboard or by mouse. Is this a Windows issue I am not aware of?
  10. Well... the MIDI input macro at this point is 868 lines of code... that was one of the most fiendishly difficult problems I ever had to solve; lots of sequencing simultaneously different points of the same array and fun stuff like that... due to the conventions of musical notation, the explicit nature of the MIDI code just cannot be translated directly into music notation code. The "text item entry" routine at this point consists of seven different macros, several of which are triggered by certain events. Total lines of code, in the aggreate, is several hundred, but that also contains a whole catalog of text items defined and referenced internally. But I have been using this now for two days, and it works like a charm. I don’t know why they can’t give us Multiple Choice windows where the choices are "formattable". In essence, I am using a text box as a multiple choice window. This is kind of daft...
  11. By the way, if it is of any interest... this turned out to be a major pickle, but I finally worked out all the kinks. For users of a different forum, I created a short video that illustrates how these macros operate. I use Macro Express extensively for working with a 16-bit MS-DOS application, that I run within DosBOX. Believe it or not, there are many people who do this... This video also shows a Macro Express macro that creates alpha-numeric input data from a MIDI input text string. Enjoy... Here is the link: https://youtu.be/FKRO_7hwk6o
  12. That’s why I append "&&THIS IS MY DOG&&" to the clipboard... I feel relative certain that I will never place that text string to the clipboard from any other source.... Anyway... I am actually quite amused at the absurdities of this challenge... but I’m almost there now!
  13. Yes, but Macro Stop is effective only for the macro that it is placed in; it cannot terminate another named macro. A lot of this is motivated by the fact that you cannot create multiple choice text boxes where the items are formatted by font. I want to be able quickly to select different text items whose text might be identical, but whose formatting is different. For instance: Allegro Allegro cresc. cresc. If you put this items into a multiple choice window, they all look the same. So you have to add some flags, like: Allegro <b> Allegro <bi> cresc. <r> cresc. <i> For longer lists, this soon becomes less than obvious. So I decided to pop these text items, formatted, into a text box. This text box is the last item in macro 1. Ctrl-Right clicking then activates macro 2. This one begins by double clicking on the item I control-right clicked in macro 1, copying that text string, and then closing the open window from macro 1. But I want the option to select more text items. So I need an IF statement to give me that option, of restarting macro 1. That works. But because macro 2 can then not continue, and thus not terminate, until the macro 1, that it called, is then terminated, the "Ctrl-Right click" activation cannot activate macro 2, as it is still active. I have now solved this problem (this is like Monty Python) by creating a text string in macro 2 that modifies a text string by appending "&&THIS IS MY DOG&&" and copying that text string to the clipboard. macro 3 (!!! YES!!!) has as an activation that when the clipboard contains "&&THIS IS MY DOG&&", it executes. This allows macro 2 to terminate, and I can refer back to macro 1 from macro 3. And now, I can "Ctrl-right click" again in my text box of macro 1... I have had to resort to subsidiary macros like that a few times in the past, but have never had to resort to three macros to get the effect that I need. I wish that Macro Express would, at some point, include the possibility to create Multiple Choice windows that display formatted text strings, and that will allow mixing radio buttons and check boxes. I know you can run external scripts (like AutoIT) to effect this, but I am not sufficiently versed in that.
  14. Is there a way to terminate a macro from within another macro? I have a macro (macro 1) that, as its last item, displays a text box. Control-right clicking on an item in that text box triggers another macro (macro 2), the "Control-right click" being the trigger for that macro. Part of macro 2 includes closing the text box of macro 1, which, being the last item in macro 1, thereby effectively terminates macro 1. When macro 2 is finished with its process, I would like to present an option, asking in essence, "do you want to run macro 1 again?" The only way I know of doing that is by inserting a "Macro Run" command at that point in macro 2. This does go back to running macro 1 again from the beginning, but the problem is that, when that final text box of macro 1 once again appears, the "Control-right click" trigger for macro 2 is now ineffective, as macro 2 will terminate only once macro 1 has terminated. Hm... going around in circles with this one.
  15. Yes, that option is checked. Cory, I don’t want to waste your time... I suspect there is a logical flaw in my script(s). For now, it appears that my "trim" command, though a klutz, has fixed this particular problem. Thank you, as always.
×
×
  • Create New...