Jump to content
Macro Express Forums


  • Posts

  • Joined

  • Last visited

Everything posted by paul

  1. My suggestion is to follow the logic below: Repeat until all variables have been copied to the clipboard repeat until %n[1]% <> %n[1]% (i.e. for ever) copy Var1 value to clipboard read clipboard value into Var2 if Var1 = Var2 exit inner repeat delay 500ms end inner repeat end outer repeat You can make this more sophisticated by counting the failures and terminating the macro after dome specified number of failures within the inner loop.
  2. While I agree this is a bug, the documentation does suggest this syntax is deprecated. If you use thie following syntax instead, you don't have the problem, although you may well have to insert delays between each statement: Text Type (Use Clipboard and Paste Text): This is a dog Delay: 40 milliseconds Text Type (Use Clipboard and Paste Text): This is a cat
  3. Actually, I'm starting to think it might be easier with AutoIt, and that it's not quite as easy as I'd thought with either offering! I'll take a more detailed look at this and see if I can come up with a useful approach.
  4. Ease of use is the main answer, plus AHK has a truly horrible, totally non-standard syntax. I'm with you there!
  5. My best suggestion is to use AutoHotkey and make it responsible for recognizing window names and firing off the relevant MEP macro. Such AHK scripts would be really simple to write.
  6. I was going to recommend an approach similar to Samrae's excellent text, but he beat me to it!
  7. But Alan, your code doesn't get triggered by anything. I believe Toast wants the macros to start automatically based on the Window title. There are 2 main approaches. If all your target windows share some common text, e.g. Windows Internet Explorer, then you could write a macro similar to what Alan described above, where this macro is triggered by a window title containing your common text being opened. I'd use this approach if possible. If there's no common text, you'll have to write one macro for each target window, and have each macro triggered by opening a window containing the target text. Depending on how many windows you're attempting to control, this may get rather messy and hard to manage. But it should work.
  8. It's not clear to me how you want to activate your macro.
  9. I don't think is very difficult to do (famous last words!). I'd start by working out how to recognize the divider between the bottom of the last row of tabs and the main part of Firefox. Then I'd calculate the height of a single row of tabs, after which you should be home.
  10. In ME3 you will have to handle this yourself. Your code will follow this logic: Repeat until %n1% <> %n1% (i.e. for ever) Launch program that opens your target window Set %n1% to 0 (just in case this variable has already been set to other than 0) Repeat 10 times If target window is present set %n1% = 1 Repeat exit else delay 2 seconds End if End repeat If %n1% = 1 Repeat exit End if End repeat Notes - Each "wait for window" set of commands (the inner repeat loop) will wait for up to 20 seconds - you can vary this as you like. - You need to determine how long to allow the outer loop to run before giving up - follow the same technique as for the inner repeat loop.
  11. Here's a 3-line example of passing in variable %T[1]% to AutoIt, and returning variable %T[2]% from AutoIt. Note that you can pass in multiple variables to AutoIt, but can receive only one parameter back (that console output variable you alluded to). Of course, you can receive from AutoIt the one variable in as complex a format as you like, e.g. a/b/c/d/e/f/g which could be converted into 7 different values in MEP. Variable Set String %T[1]% to ""Input Parameter"" External Script: AutoIt Text Box Display: <VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="\"Input Parameter\""/> <EXTERNAL SCRIPT Language="AutoIt" Dest="%T[2]%" Script="msgbox(0,\"My Title\",\"My Text\")\r\nConsoleWrite(\"Returned Value is \" & $CmdLine[1])\r\n\r\n" Parameters="%T[1]%"/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang3081{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Passed in:%T[1]%\r\n\\par Returned:%T[2]%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
  12. Take a look at this to see if there's anything that might be of use. http://4sysops.com/archives/vista%E2%80%99s-uac-8-ways-how-to-elevate-an-application-to-run-it-with-administrator-rights/ If you can create a command prompt window, then you could use MEP to control running programs using that window.
  13. We also seem to have lost the ability to remember where we were in a thread - in other words, this forum used to scroll down to the 1st unread message in a thread (useful if there are lots of messages). This is so typical of software development these days - ignorance reigns supreme.
  14. In most circumstances I agree with you. But when comparing W2k with W7, well, really, you're missing out on so much. W7 is so good, compared with everything that went before.
  15. And there we were, getting on so very nicely. Now you've made me cry. Windows 2000? Oh, please tell me it ain't so.
  16. I don't think you will find any positive results. I've just been playing with this some more. I have this macro, that returns the current time of day in seconds since midnight. <VARIABLE SET INTEGER Option="\x13" Destination="%N[1]%"/> <VARIABLE SET INTEGER Option="\x14" Destination="%N[2]%"/> <VARIABLE SET INTEGER Option="\x15" Destination="%N[3]%"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%N[1]%" Value1="%N[1]%" Value2="3600"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%N[2]%" Value1="%N[2]%" Value2="60"/> <VARIABLE MODIFY INTEGER Option="\x00" Destination="%N[1]%" Value1="%N[1]%" Value2="%N[2]%"/> <VARIABLE MODIFY INTEGER Option="\x00" Destination="%N[99]%" Value1="%N[1]%" Value2="%N[3]%"/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang3081{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %n[99]%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="2" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> When run, this returns 8498 when the time is approximately 02:21 But I cannot persuade it to return anything other than 0 when run within a macro (remembering to replace all % signs in the variable being set to {%}, and to include the NoEmbeddedVars="FALSE" command in each line, as per the Help). <VARIABLE SET STRING Option="\x00" Destination="%tMacroCode%" Value="<VARIABLE SET INTEGER Option=\"\\x13\" Destination=\"{%}N[1]{%}\" NoEmbeddedVars=\"FALSE\"/>\r\n<VARIABLE SET INTEGER Option=\"\\x14\" Destination=\"{%}N[2]{%}\" NoEmbeddedVars=\"FALSE\"/>\r\n<VARIABLE SET INTEGER Option=\"\\x15\" Destination=\"{%}N[3]{%}\" NoEmbeddedVars=\"FALSE\"/>\r\n<VARIABLE MODIFY INTEGER Option=\"\\x02\" Destination=\"{%}N[1]{%}\" Value1=\"%N[1]%\" Value2=\"3600\" NoEmbeddedVars=\"FALSE\"/>\r\n<VARIABLE MODIFY INTEGER Option=\"\\x02\" Destination=\"{%}N[2]{%}\" Value1=\"%N[2]%\" Value2=\"60\" NoEmbeddedVars=\"FALSE\"/>\r\n<VARIABLE MODIFY INTEGER Option=\"\\x00\" Destination=\"{%}N[1]{%}\" Value1=\"%N[1]%\" Value2=\"%N[2]%\" NoEmbeddedVars=\"FALSE\"/>\r\n<VARIABLE MODIFY INTEGER Option=\"\\x00\" Destination=\"{%}N[99]{%}\" Value1=\"%N[1]%\" Value2=\"%N[3]%\" NoEmbeddedVars=\"FALSE\"/>\r\n<TEXT BOX DISPLAY Content=\"{\\\\rtf1\\\\ansi\\\\ansicpg1252\\\\deff0\\\\deflang3081{\\\\fonttbl{\\\\f0\\\\fnil\\\\fcharset0 Tahoma;}{\\\\f1\\\\fnil Tahoma;}}\\r\\n\\\\viewkind4\\\\uc1\\\\pard\\\\f0\\\\fs16 %n[99]%\\\\f1 \\r\\n\\\\par }\\r\\n\" Left=\"Center\" Top=\"Center\" Width=\"278\" Height=\"200\" Monitor=\"2\" OnTop=\"FALSE\" Keep_Focus=\"TRUE\" Mode=\"\\x00\" Delay=\"0\"/>" NoEmbeddedVars="FALSE"/> <RUN MACRO IN VARIABLE Variable="%tMacroCode%"/> Update 10 minutes later OK, the Help file sprouts garbage! I got this to work as follows: - ignore the {%} Help statement, and omit the NoEmbeddedVars="FALSE" statement - instead, simply copy the desired commands, and tick the Don't process embedded variables tick box <VARIABLE SET STRING Option="\x00" Destination="%tMacroCode%" Value="<VARIABLE SET INTEGER Option=\"\\x13\" Destination=\"%N[1]%\"/>\r\n<VARIABLE SET INTEGER Option=\"\\x14\" Destination=\"%N[2]%\"/>\r\n<VARIABLE SET INTEGER Option=\"\\x15\" Destination=\"%N[3]%\"/>\r\n<VARIABLE MODIFY INTEGER Option=\"\\x02\" Destination=\"%N[1]%\" Value1=\"%N[1]%\" Value2=\"3600\"/>\r\n<VARIABLE MODIFY INTEGER Option=\"\\x02\" Destination=\"%N[2]%\" Value1=\"%N[2]%\" Value2=\"60\"/>\r\n<VARIABLE MODIFY INTEGER Option=\"\\x00\" Destination=\"%N[1]%\" Value1=\"%N[1]%\" Value2=\"%N[2]%\"/>\r\n<VARIABLE MODIFY INTEGER Option=\"\\x00\" Destination=\"%N[99]%\" Value1=\"%N[1]%\" Value2=\"%N[3]%\"/>\r\n<TEXT BOX DISPLAY Content=\"{\\\\rtf1\\\\ansi\\\\ansicpg1252\\\\deff0\\\\deflang3081{\\\\fonttbl{\\\\f0\\\\fnil\\\\fcharset0 Tahoma;}{\\\\f1\\\\fnil Tahoma;}}\\r\\n\\\\viewkind4\\\\uc1\\\\pard\\\\f0\\\\fs16 %n[99]%\\\\f1 \\r\\n\\\\par }\\r\\n\" Left=\"Center\" Top=\"Center\" Width=\"278\" Height=\"200\" Monitor=\"2\" OnTop=\"FALSE\" Keep_Focus=\"TRUE\" Mode=\"\\x00\" Delay=\"0\"/>" NoEmbeddedVars="TRUE"/> <RUN MACRO IN VARIABLE Variable="%tMacroCode%"/> Notes 1. The final display command can either be part of the code stored in the variable or run after the macro variable has been run, because the value %n[99]% is not out of scope once the macro variable has been run - its value is retained. 2. I changed all the %n[x]% references to %an[x]%, declared variable %an% as an integer array of 99 elements making it available to macros, and, to my amazement, the code worked. So it looks as if Insight has done a lot of work in this area, almost none of which has ever been described in any of their documentation accompanying each new release. To sum up: it looks as if user variable names are fine as long as they are predefined in the macro that runs the macro variable command. Further, variables persist even after the variable macro has run. I take my hat off to Insight for this - 'tis a shame about the lack of documentation.
  17. No conflicts occur. Not that I know of. But I am willing, able and available (for a fee) to help you with this, or to do the conversions for you if you don't have the time. Wiki recommended Regular Expressions Function documentation Regular Expressions Forums search for StringRegExp
  18. It does for me! Try this code and let us know what your results are: <VARIABLE SET STRING Option="\x00" Destination="%t[1]%" Value="First" NoEmbeddedVars="FALSE"/> <VARIABLE SET STRING Option="\x00" Destination="%t[2]%" Value="Second" NoEmbeddedVars="FALSE"/> <VARIABLE SET STRING Option="\x00" Destination="%t[3]%" Value="Third" NoEmbeddedVars="FALSE"/> <VARIABLE SET STRING Option="\x00" Destination="%t[4]%" Value="ourth" NoEmbeddedVars="FALSE"/> <VARIABLE SET STRING Option="\x00" Destination="%t[5]%" Value="Fifth" NoEmbeddedVars="FALSE"/> <VARIABLE SET INTEGER Option="\x00" Destination="%n[1]%" Value="1"/> <VARIABLE SET INTEGER Option="\x00" Destination="%n[2]%" Value="2"/> <VARIABLE SET INTEGER Option="\x00" Destination="%n[3]%" Value="3"/> <VARIABLE SET INTEGER Option="\x00" Destination="%n[4]%" Value="4"/> <VARIABLE SET INTEGER Option="\x00" Destination="%n[5]%" Value="5"/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang3081{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 The 5th element of t1 is %t[5]%\r\n\\par \r\n\\par The nth element of t1 is %t[%n[5]%]%\\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="2" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
  19. Cory, none of these settings makes the slightest difference - I have tried them all.
  20. Not long after MEP was released, I complained about the rotten implementation of the Run Macro in Variable command which had worked so successfully in ME3. Variable handling hardly works, since MEP has no ability to decide what type a variable is, though I seem to remember that %t[n]% formats may work OK. I can no longer remember the details, but I decided that this command obviously proved far too hard for Insight - I don't know why they ever included it in MEP. In days of yore, I co-authored a macro library for ME3, which depended heavily on this command.
  21. AutoHotkey is a very useful utility, and I suspect there are some things (mainly keyboard and hotkey orientated) that cannot be done so easily in other languages like AutoIt (which shares some common ancestry with AutoHotkey). But as far as language constructs and syntax are concerned, AutoHotkey really is truly horrible. It's totally non-standard; one example is of text strings that included embedded spaces, which, in most cases, don't require (and must not use) surrounding quotation marks. I'm certain that AutoIt is at least as powerful as AutoHotkey in its handling of regular expressions, and I firmly believe that the AutoIt Help documentation is superior to that in AHK, and that the AutoIt forums are supported in a more professional way.
  22. While Firefox is still loading a page, you'll notice that there's an X between and below Edit and View in the menu bar that is not greyed out. I've written a macro called FirefoxLoaded that runs after I've requested a specific URL, and returns control only after this X becomes greyed out, OR after a timeout usng some predefined value (in my case, 120 seconds). FirefoxLoaded checks for a specific pixel value in the centre of the X (this pixel value, together with its exact location, varies according to the graphics card and OS you use, but, once set, is stable).
  23. This is quite odd! My default browser is Firefox, for which the Web SIte command works as expected; if Firefox is not running, this command loads Firefox with the requested page. If Firefox is running, this command simply opens a new tab showing the requested page. But, like you, my experience with IE is quite different. The Web Site command always seems to open a new non-maximized window for IE, even though I have declared my preference for tabs. So I suggest the following code as a workaround: Variable Set String %tUrl% to "www.myhq.com" If Not Program "IEXPLORE.EXE" is running Program Launch: "iexplore.exe" (Normal) Parameters: End If Window Activate: Internet Explorer Text Type (Simulate Keystrokes): <ALT>d Delay: 500 milliseconds Text Type (Simulate Keystrokes): %tUrl%<ENTER> <VARIABLE SET STRING Option="\x00" Destination="%tUrl%" Value="www.myhq.com" NoEmbeddedVars="FALSE"/> <IF NOT PROGRAM Option="\x01" Program="IEXPLORE.EXE"/> <PROGRAM LAUNCH Path="C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe" Mode="\x00" Default_Path="TRUE" Wait="1" Get_Console="FALSE"/> <END IF/> <WINDOW ACTIVATE Title="Internet Explorer" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <TEXT TYPE Action="0" Text="<ALT>d"/> <DELAY Flags="\x02" Time="500"/> <TEXT TYPE Action="0" Text="%tUrl%<ENTER>"/>
  • Create New...