Jump to content
Macro Express Forums


  • Posts

  • Joined

  • Last visited

Everything posted by MakaPakaTobyHannah

  1. I don’t know if this has been discussed here before; I couldn’t find a reference. Anybody have experience with Macro Express and Quark 8.02, in Windows 10? In my installation, none of my Macro Express keyboard shortcuts (such as "type text" macros) activate. I have a whole range of "diacritic" keyboard shortcuts, for umlauts, letters with accents, etc. etc. I use those in any application. But within Quark, they will not execute. Does anyone have any insight? Thanks.
  2. I am trying to edit an XML file by deleting all text between certain tags, including the tags themselves. For instance: <system-layout> <system-margins> <left-margin>22</left-margin> <right-margin>0</right-margin> </system-margins> <top-system-distance>218</top-system-distance> </system-layout> could be part of the XML file. I would want to delete all text between the tags "<system-layout>" and "</system-layout>", including the tags themselves. The tags could occur multiple times in any given XML file. I wish there were an option in ME to "delete substring" within the text variable I assign the XML content to, where the content between the tags could be represented by wildcard characters, such as "delete "<system-layout>*</system-layout>" (you get the drift). I'm sure there I could come up with something by splitting the text string multiple times (yada yada), but that seems like a pain. Anybody have a "simple" solution to this problem? Cheers, MakaPaka
  3. I knew it... I would get some good responses. Thanks for the feedback, this is very helpful and clarifies what's doable and what isn't. Cheers, everybody!
  4. This may be very simple, but that's never stopped me from not being able to figure things out. I'm doing a bit more now with embedding AutoIT scripts as "External Scripts" into my macros, mostly for building more sophisticated GUIs. My question is: how do you pass the values of variables OUT of the AutoIT script portion into Macro Express? Passing Macro Express variables INTO the AutoIT script portion is easy, of course. But I can't figure out an easy way to do the reverse. The way I've been doing it is by copying an AutoIT variable to the clipboard, and upon completion of the AutoIT portion assigning a new variable in the Macro Express macro from the clipboard. That seems very clumsy. Also, it's a bit of a problem if the AutoIT script portion references multiple variables, possibly of different types. I'd have to concatenate all those variables into one string, for instance, with some separator characters, such as $^$^ (something like that), then in Macro Express get the variable as a string from the clipboard, split the string at the separator characters, convert types (some portion of it may need to be an integer or a decimal), blabla. That all seems very daft... What am I missing? I thought that the %console% variable might help; alas, it doesn't. The help file explains: >> Save Console Output To: This function saves the output from the script to a text string variable and is only used if the output is sent to one of the console screens. << I don't even know what that means. Which console screens? I know what a console screen is (at least I thought I did), but I just don't understand what that means, and why the console output variable is required. So... maybe this is a two-part question: 1) how to pass variables out of the AutoIT script portion into Macro Express; and 2) what is the purpose and use of the required console output variable. Thank you! Each time I post on this forum, I learn new things, and have always received solutions, or enough feedback to help me come up with a solution...
  5. How would you decide which files to copy? Would you decide that yourself? Would you select the file(s) with which you want to do this yourself? Where would you want the copies to be placed? Into the same directory? Is the directory path fixed, or will it vary? Knowing this would make it easier to decide which is the most efficient solution to your question.
  6. I am calling up a multiple choice window. I've set up a default assignment of the "choice" variable within the multiple choice window so that, when the multiple choice window appears, a specific button is preselected (as the default); in other words, I assign a value to the choice variable (say "A") before the multiple choice window appears, causing the button by choice "A" to be preselected. Now, if I actually wish to make another choice, I can of course click on another multiple choice button, say button "B". What I am looking for is for the new choice to become the new default, so that, when I run the macro again, the preselected button will be "B", not "A". I know I can get this effect by saving that assignment to a text file, and then when I run the macro again have the "choice" variable assigned by reading the content of that text file - in effect, the default button becomes the button that was selected the last time I ran the macro. Fine, no problem. But rather than populating my disk with such "ini" files of sorts, or making one huge ini file to store all such settings, I wonder if it is possible to change the static assignment of a variable within the macro to reflect the choice made in the multiple choice window. As it is, I define the default "choice" like this: >> Variable Set String %printJob% to "A" Multiple Choice Menu: Make EPS files << In the Multiple Choice Menu, button "A" will now be preselected. But is there any way to pass the value "B" to the Variable Set String command, if I chose button B in the multiple choice menu, and have that new value saved somehow inside the macro to function as the new default next time I run the macro? Hm...
  7. The only potential problem I can see with the loop / iteration method is that the speed at which ME will execute this will be fixed - but I can easily imagine some sort of processor activity going on that may temporarily interrupt, or delay, the buffering of the keystrokes, which, as you get into the hundreds, may well select the wrong report at some point. Once you're off by one single arrow stroke, everything following will be wrong. Just a word of caution...
  8. Thank you Cory, as always... for your very helpful response. It's good to know I'm not the only who has experienced this kind of issue. I will explore your suggested solutions. I've only just begun using external scripts as part of ME routines; for instance, input windows with both radio buttons and check boxes - and maybe roll-down menus etc. are in-your-dreams-only features of ME, at least for now - but can be accomplished by inserting external scripts. Cheers to everyone who chimed in. And to conclude, based on Cory's suggestion, this macro now works in a fraction of a second, when it could have easily taken up to one minute: Variable Set String %origEPSFile% to "*.EPS" // this will display only EPS file in the next line Variable Set String %origEPSFile%: Prompt for a filename // I select the EPS file to be processed here External Script: AutoIT //The AutoIT script looks like this: // //#include <file.au3> //Dim $aRecords //_FileReadToArray("%origEPSFile%",$aRecords) //For $x = 1 to $aRecords[0] // if stringinstr($aRecords[$x], "statusdict") then _FileWriteToLine("%origEPSFile%", $x, "", 1) //Next // //End of AutoIT script Text Box Display: "Statusdict" command has been removed. Good thing, that!
  9. I'm wondering if there isn't a more reliable method of obtaining your result. For instance, you write, "(select dropdown (down) enter.. then the next one select dropdown (down)(down)(enter) 730 times", which seems to indicate that for each new report, you'll have to add another "(down)" statement to your selection method, up to 730 times: is that what you intend? Also, I'd probably stay away from doing too much with mouse clicks, especially if processing speeds may vary depending on what's going on in your computer at the time. Finally, what happens if you now have more, or fewer, than 730 reports? I would probably aim at constructing a solution that will work for you regardless of how many files (reports) there are. Is it possible for you to call up a report as a file, say, by using some kind of "Ctrl-open" command? Are these reports stored as individual files on your system? If so, I'd probably investigate assembling a text file that lists all of the report files in order, like this, report1.rpt report2.rpt report3.rpt or whatever. Then, you can call up each file to do what you want simply by using the "Text File Begin Process" method. Anyhow, I'm just speculating, as I don't fully understand the environment you're working on. Maybe you can provide more specifics?
  10. I am running Windows 7. Among my fonts, I have a font called "Terminal," which includes certain "console" characters not available in other fonts. When I use this font in Notepad, for instance, I can call up program-internal helpscreens that were designed to display in a DOS window, and all characters display correctly in Notepad / Windows. The font is properly installed, as far as I can see. Without using this font, the text display items become garbled and unusable on the Windows side. I made a macro to read in this set of helpfiles and then displaying the contents in a text box. In the text box, I have indicated "Terminal" to be used as the display font. Yet, the font does not display. What could possibly be the problem?? Without solving this issue, the macro becomes unappealing, as I do not want to launch Notepad in order to display the help file contents - I just want a text box that closes when I click OK. Any ideas? Thanks in advance.
  11. I need to devise a process with which to modify an EPS file. The EPS file is plain text, of course, and can be viewed in any text editor. The program I use unfortunately, depending on the page size chosen, inserts an illegal "statusdict" command into the EPS file. This causes problems when trying to distill the file to a PDF. Removing the entire "statusdict" line, which could be something like: "statusdict /setpage known {statusdict begin 792 1224 1 setpage end} if" always solves the problem. I can easily do this in Notepad, for instance, by locating the instruction, and then deleting the entire line. My strategy has been to assign the contents of the file to a variable, and then either splitting the string several times, and rejoining the split segments, or by using "Text File begin Process" to read through each line, and appending each line, except for the line containing "statusdict", to a receiver variable; once that is done, I would modify the receiver variable: Modify String: save to text file. This does work. The problem is, such an EPS file can be quite long. The one I tested with is 31,191 lines long. As a result, the process is extremely extremely slow: easily in excess of one minute. I cannot think of any other procedure by which to obtain the desired result; yet at this speed, I'd be faster opening the file in Notepad and manually editing it. Is there a better approach? Thanks in advance!
  12. Thank you, Paul, Cory, Samrae! I've looked at your code, Cory, and I understand where you're going with it; it would still take quite a bit of effort, it seems to me, to allow wildcard entries of any kind, such as, "create a file list of all files with the following file mask: '?PA*B.MU?'" - an otherwise perfectly legal instruction in CMD: and the object, of course, is that this would have to be robust enough to cover ANY circumstance. Of course, absent my ability to solve this directly in Macro Express, I have resorted to calling CMD to obtain the result. My process therefore coincides with Paul's solution, except that I prefer to do this unseen in the background - so I call CMD "Hidden," not "Normal." I do get the desired effect therefore in this manner: >> Variable Set String %fileMaskMainFiles%: Prompt Variable Set String %fileMaskMainFiles% to "dir %fileMaskMainFiles%/b/-p/-w>inmain.txt" Program Launch: "CMD.EXE" (Hidden) Parameters: /C "%fileMaskMainFiles%" << And finished. I hope you don't mind the query anyway; I'm always interested in finding ways to do things directly in ME, rather than having to rely on calls to other applications. I've kept Cory's solution as a springboard, in case I want to return to it in the future... Anyhow, thanks again - this is good enough for me.
  13. This is an older post by now, so probably no longer acute. Still, I think there is an easier solution - if I understand fully what is desired. It sounds as if the main problem is that you don't want to use a hotkey to activate the macro, but want to constrain yourself to activating the macro from a menu. The trouble is, when you do so, the "topmost window" once you activate your macro is the macro activation list itself, not the window that was active just before you go into the macro activation list. I solve this problem like this: >> // Comment: The following delay has been inserted in case the macro is invoked from a menu. In that case, the "topmost window," when the macro starts executing, might in fact be the menu window itself, causing the macro to fault. Delay: .2 seconds << That works without fail: once you activate the macro from the list, the "macro activation list" window disappears, and the focus returns to the window that was active before you activated the macro. Then you can capture the window title etc. etc. in the usual way. Maybe the issue isn't quite this... in which case I'll try posting a different solution. Cheers!
  14. I'm stuck with the following problem: I am trying to create a text file that lists, in order, all files in a given directory, that correspond to a certain file mask. For instance: I have a directory named S:\score4\xxxx. In that directory reside a number of files AT THE MOMENT that coincide with this file mask: P*.MUS. (So this could include P100.MUS, P101.MUS, P102.MUS, etc.) In the same directory also reside AT THE MOMENT files that coincide with this file mask: S*.MUS. (So this could include S128A.MUS, S128B.MUS, S129A.MUS, etc.) I would like to generate TWO text files that list the files according to the specified file mask. For the moment, I get the "P*.MUS" files with this: >> Repeat with Folder S:\score4\xxxx If Variable %fullList% Contains ".MUS" And If Variable %fullList% Contains "P" Variable Modify String %makeFullList%: Append Text String Variable (%fullList%) Variable Modify String %makeFullList%: Append Text String Variable (%T13%) Variable Modify String %makeFullList%: Append Text String Variable (%T10%) End If End Repeat Variable Modify String: Save %makeFullList% to "S:\Score4\xxxx\inmain.txt" << I should explain that %T13% and %T10% append carriage return / line feed. Next, I attempted to get the "S*.MUS" files with this: >> Repeat with Folder S:\score4\xxxx If Variable %fullList% Contains ".MUS" And If Variable %fullList% Contains "S" Variable Modify String %makeFullList%: Append Text String Variable (%fullList%) Variable Modify String %makeFullList%: Append Text String Variable (%T13%) Variable Modify String %makeFullList%: Append Text String Variable (%T10%) End If End Repeat Variable Modify String: Save %makeFullList% to "S:\Score4\xxxx\inapp.txt" << I quickly realized that this includes all the P*.MUS files as well, because "S" is also contained in the extension "MUS." So that didn't work. I modified the program for the "S*.MUS" files accordingly: >> Repeat with Folder S:\score4\xxxx If Variable %appList% Contains ".MUS" And If Variable %appList% Does not Contain "P" Variable Modify String %makeAppList%: Append Text String Variable (%appList%) Variable Modify String %makeAppList%: Append Text String Variable (%T13%) Variable Modify String %makeAppList%: Append Text String Variable (%T10%) End If End Repeat Variable Modify String %makeAppList%: Trim Variable Modify String: Save %makeAppList% to "S:\Score4\xxxx\inapp.txt" << Now, that does give me the text files I need - but is decidedly NOT the smart way to proceed; the filenomenclature / file masks can always be different. Instead of "P*.MUS" files I could easily have "N*.MUS" files etc. In that case, the macro won't work; I would like to be able to indicate the file mask somehow (such as "X*A.MU?", for instance), and have the text file created accordingly. In DOS (i.e. CMD.EXE), you can easily create such text files in this manner: dir p*.mus/b/-p/-w>inmain.txt dir s*.mus/b/-p/-w>inapp.txt and finished. Change the wildcards to anything at all, and the file list is created. How can this be accomplished within MacroExpress? I look forward to hearing some ideas! And thank you in advance!
  15. Paul, thanks indeed for your solution. It didn't work when modified to suit my requirements, but it steered me in the right direction. For some reason, the new macro you suggested I needed to create was not able to get the window information (the window to activate) from %activeWindow%, even though it is defined as a global variable. I know there is some reason why the information isn't been passed on, but I didn't care enough to investigate. Contrary to your suggestion, I am not calling my existing macro from the new macro. Rather, I call the new macro from the existing macro just before the If Message is displayed. The way I get %activeWindow% to be recognized by the new "activation" macro is by passing it through an Environment Variable that I've set aside for that type of thing. The "activation" macro is extremely simple now and gets me what I need: Variable Set String %activeWindow% to Environment Variable, "%SwapVariable1%" :start If Window "Accept ES result?" is running Window Activate: %activeWindow% Macro Stop Else Goto:start End If Anyhow, it was your suggestion that within minutes steered me to the solution I needed. Thanks very much, indeed!
  16. Is there any way to accomplish the following? Inside a larger macro, at the end of a complex operation, I want to be able to view the results of the modification undertaken by the macro on an open document. If I like the result, I click "Accept," if not, I click "Undo." The "Accept" and "Undo" options become available through an If Message: If Message "Accept result?" Delay: .2 seconds Window Activate: %activeWindow% Goto:end Else Goto:undo End If I want the If Message to stay open until I have perused the entire document specified in %activeWindow%. But in order to examine that document (I need to scroll inside of it using the arrow keys), I always have to ACTIVATE that document first, once the If Message appears. I can do that by clicking on the document, of course, but it would be much more convenient to have the Window activate automatically, so I could immediately proceed to scrolling with the arrow keys. I tried out the approach above, but I see why I wouldn't work, as the macro itself pauses at the If Message, waiting for True or False input; therefore, the embedded Window Activate command doesn't execute when I need it to. Is there a solution to this problem? Thanks!
  17. Thanks, Cory and Paul, helpful at least to confirm that it wasn't down to something I was missing or doing wrong. Odd indeed that Windows File Explorer would list these files in lexicographic order (e.g. file1, file10, file2, file20 file3 ... ) but that the operating system would report them in numerical order (e.g. file1, file2, file3,...,file10, file11,...,file20) - I think that's the difference. Both sorting methods are perfectly fine and "correct" - it is a question of preference. Paul's suggestion is spot on: and that's really wny I created this macro. It is meant to deal with situations where the nomenclature of these files is NOT as Paul suggests; in other words, using Paul's nomenclature obviates the need for which I designed the macro. I havent' checked yet to see if the sorting of files in CMD is different from file explorer, as Cory seems to have observed. That would be bizarre indeed. One remaining option I will try is to call CMD in a hidden session from the macro, invoking its own "SORT" command on the file list, and then to see what pops out... anyhow, that's good enough for me. Cheers, Jürgen
  18. I've constructed a simple macro to display all *.TXT files in a given directory by listing them, one by one, through a string variable (using carriage returns and line feeds) displayed in a text box, using the "Repeat with Folder" command. The order in which the files appear is: 01.TXT 02#034B.TXT 02.TXT 02A.TXT 28A.TXT 100ABC#D.TXT 201.TXT Yet the order in which the files are processed (and then displayed) is: 01.TXT 02#034B.TXT 02.TXT 02A.TXT 100ABC#D.TXT 201.TXT 28A.TXT That is, 28A.TXT has moved to the bottom of the list. Is this a known issue? Am I missing something? Curious if someone has the solution to this.... thanks!
  • Create New...