Jump to content
Macro Express Forums

ThatJimGuy

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by ThatJimGuy

  1. lol, at least SOMEONE understands! Always a good feeling. Thanks man! I'm gonna install MEPro. I've been holding off because I'm not sure if my old config and macros will be safe. But I'll export them all first and, since I'm going off-topic, will stop here. At least I got a solution. //slight rant BEGIN Insight told me that the checking is done by the Scripting Editor and that if I enter Direct Editor commands and run them in a variable, it could cause ME to crash, and that it's basically my responsibility. I disagreed. All they have to do is throw and catch an exception should the code in the variable not be able to be run. I understand they can't parse it to check it because the parsing and checking are done at the Scripting Editor level, but man, you can't just run the results of the conversion (to "direct editor" code) without some sort of error handling! There's 1-2 more levels below that where they can check for or catch errors (Direct Editor code -> C/C++/whatever, then C/C++/whatever calling their libraries to execute the code, or maybe just calling their library functions and passing the direct editor code... I dunno, I didn't write the thing, but they can catch the errors, and IMHO, SHOULD!) They don't have to tell people what the problem is, just that there is a problem. Not just let ME crash and burn with no error messages except the TalkBack module popping up once it notices that ME crashed... //slight rant END Hopefully they will make some fixes and catch the null pointers and such that cause ME to crash when you try to run nonsense in a variable (well, what may seem OK at the time, but turns out to be incorrect once you notice that ME crashes) ;-) Thanks to all for the examples and comments! :-) ~jim (guy, that)
  2. For 5 integers, sure, I could just do this: Variable Set Integer %N1% with a Random Number Variable Set Integer %N2% with a Random Number Variable Set Integer %N3% with a Random Number Variable Set Integer %N4% with a Random Number Variable Set Integer %N5% with a Random Number There are some reasons why this is not optimal coding: 1) 5 integers is an example, I may be setting 20 or 30 2) The integers are set in a repeat loop, not just to get the number of the integer (i.e. N1, N2, N3 etc.) to set from the counter, but to also use additional logic within the repeat loop to set each variable depending on other factors. In other words, again, this was an example for brevity. I could actually be setting N1 to something that depended on the value of N9 in another way, like maybe a random number between 1 and N9 instead of a static value for the max random number. Or I could be opening a file called "FileX.txt", where X is the value in N9. So N1 is set based on the contents of the file "File1.txt", N2 is set based on the contents of File2.txt, etc. etc. Throw in a few IF and SWITCH statements or other logic (some quite complex) and I think you can understand why I would want to do it this way. 3) Taking (1) and (2) into consideration, this would be a really messy macro, setting and modifying each variable one at a time instead of in a repeat loop where I can use the counter to "set" the variable "number" that I wish to set. And now, I have to run the following macro before pressing the "Add Reply" button: Variable Set Integer %N1% to 3 Variable Set String %T1% "coffee" Variable Set String %T2% "cup" Variable Set String %T3% "desk" // (Place counter in N2) Repeat with Variable using %N1% Variable Set String %T4% "I have had %N2% %T2%" If Variable %N2% > 1 Variable Modify String: Append "s" to %T4% End If Variable Modify String: Append " of %T1%, " to %T4% Variable Modify Integer: %N3% = %N2% - 1 If Variable %N3% = 0 Variable Modify String: Append "none " to %T4% Else Variable Modify String: Append "%N3% " to %T4% End If Variable Modify String: Append "of which " to %T4% If Variable %N3% = 1 Variable Modify String: Append "is " to %T4% Else Variable Modify String: Append "are " to %T4% End If Variable Modify String: Append "now empty on my %T3%." to %T4% Text Type: %T4%<ENTER> Repeat End Variable Set String %T5% "The mind is a terrible thing to waste." Replace " to waste" with "" in %T5% Text Type: %T5%<ENTER> And Lo, it came to pass that the code was good, and there was much rejoicing: "I have had 1 cup of coffee, none of which are now empty on my desk. I have had 2 cups of coffee, 1 of which is now empty on my desk. I have had 3 cups of coffee, 2 of which are now empty on my desk. The mind is a terrible thing."
  3. Actually, no. I just dereferenced them in my macro the way that was suggested (for the text, this was something like setting %T%T2%% to a value (if T2="1", I would be setting T1, for example)). I could not use that same method with integers or decimals due to the edit control input restrictions on the "Variable Set Integer" dialog (it only accepts N1, not N%N1% or things like that. ("Things like that" being a rather broad technical term for "things I'd rather not post lest I confuse others and myself even more"). So I defer to Steve's response about the /s character which is explained in the ME help file as well as, (I presume) the book. I prefer to call my Higher Power "Fido", but yeah, I can relate to that. ;-)
  4. Sorry, I was very tired when I wrote that. N9 contains the NUMBER of the N variable I want to set. So, for instance, let's say I have 5 integers (N1, N2, N3, N4, N5) I want to set to a random number. I have a repeat loop, which repeats 5 times, putting the counter into N9. Here is what I want to do: Repeat 5 times (put counter into N9) Set variable N%N9% to some calculated value End repeat So the first loop, it sets N1, the second, it sets N2, and so on until pass 5 where it sets N5. If I try to set %N%N9%% in a "Variable Set Integer" command, I get this error: So, I finally solved it by doing this, in case anyone else out there ever tries to do the same thing: Repeat Start (Repeat 5 times) Variable Set Integer %N10% with a Random Number Variable Set String %T4% "<IVAR2:%N9%:01:%%N10%%>" Run Macro in Variable %T4% Repeat End NOTE the single % signs around N9 (this is the VALUE of N9, i.e. 1,2,3...) and the double % signs around N10 (if you put just single % signs around it, you would be trying to set %N9% to %N%N10%%!!) That's a lot of gobbledygook so just trust me, if you don't do it this way, you will be setting N9 to things like N65, N33, or whatever the random number is; you will be setting N9 to random variables, not the random number that is in N10. Also, don't even try to put "<IVAR2:%N9%:01:%%N10%%>" in the direct editor and then switch back to the scripting editor (well go ahead and try it if you want, but don't hold me responsible when your macro looks funky after) ;-) It would be nice to be able to just put %N%N9%% in the "Variable Set Integer" command and the equivalent for the decimals. The set text commands allow for it, but you have to use the direct editor equivalent and run it in a macro to set integer and decimal values like this. TMI? Probably. Not good to program and post when you're sleep-deprived, so if this doesn't make sense or parts are incorrect (don't worry, the CODE is correct), let me know and I'll edit it tomorrow after a good night's sleep.
  5. Thanks Kevin (2 years later lol) that works for text, but I cannot for the life of me figure out how to get it to work for integers. I want to set N[N9] to N10, but when I use the "Variable Set Integer" command, it will not accept %N%N9%% as a variable to set. If I try to set T4 to a variable with the dereference (Variable Set String %T4% "%N%N9%%") , T4 always ends up to be "0", no matter what N9 is (and N9 <> 0!). If I try to do it with the direct editor (<IVAR2:%N%N9%%:01:%N10%>), ME crashes. So does setting T5 to "<IVAR2:%N%N9%%:01:%N10%>" and using the "Run Macro in Variable %T5%" command. No, it doesn't like this at all lol ;-) It doesn't like this either (thinking that maybe I had to delimit the % symbols): <IVAR2:\%N\%N9\%\%:01:\%N10\%> So I guess I'm back to a case statement based on the counter in the repeat loop unless you have any ideas on dereferencing integers (or decimals)? If my post doesn't make sense, please let me know. Basically, I want to set %N%Nx%% to %Ny%, where x is variable and y is static.
  6. I NEVER use double-click because it's not reliable. Instead, for each click, try using: Mouse Left Button Down Mouse Left Button Up So, in your case, for a double left mouse click do this: Set Focus to %C7% Mouse Left Button Down Mouse Left Button Up Mouse Left Button Down Mouse Left Button Up If this doesn't work (I haven't tested it), let me know and I'll figure it out for you. -jim
  7. OK, here's what I want to do: set string variables (T1, T2, T3, etc.) then run a macro that has a repeat counter, the current value of the counter being the x value of Tx. For example, first loop pass, I want to do something with T1, next loop, T2, etc. I would really like to dereference the variable, instead of using a "case" statement, like thus (which doesn't work, btw, and I have also tried to "run macro in a variable, which also doesn't work): Variable Set Integer %N1% to 1 Variable Set String %T1% "whatever" Variable Modify Integer: Convert %N1% to text string %T2% Variable Set String %T3% "%T%T2%%" // But I want T3="whatever" NOT T3="%T%T2%%" !!! PS This is simplified. Any ideas? Remember, I want it simple and fast, no I/O. tia, -jim
×
×
  • Create New...