Jump to content
Macro Express Forums

terrypin

Members
  • Posts

    2,230
  • Joined

  • Last visited

  • Days Won

    23

Everything posted by terrypin

  1. Why not start with one of the simpler methods then? Also, I suggest you study the excellent Help, which covers several of your questions. For example, you say you're not sure what Variable Modify Integer: Inc (%N1%) means. Have you studied the explanation under Help > Index > Variables > Modify Integer Variable ? -- Terry, East Grinstead, UK
  2. OK, sorted thanks. It seems that I need to add a special code, '\s', at the end of my text. So that line becomes Variable Set String %T1% "<TEXTTYPE:Example of text\s>" -- Terry, East Grinstead, UK
  3. This stems from the thread 'Assigning New Variables on Each Loop'. Steve's post there prompted me to try a command I haven't used before: Run Macro in Variable. But I consistently get behaviour I don't understand, namely the insertion of an extra '>' character at the end of my variable when it gets run. Here's a simple example. Activate Window: "Notepad" Variable Set String %T1% "<TEXTTYPE:Example of text>" Run Macro in Variable %T1% Macro Return <ACTIVATE2:Notepad><TVAR2:01:01:<TEXTTYPE:Example of text>><RUNMACVAR:1><MRETURN> That should type into Notepad the string Example of text But I get Example of text> If I remove the right hand > from the variable then the result is OK. Adding delays, changing the variable etc, none made any difference. Can anyone reproduce this please? If not, I have to assume it's some sort of conflict unique to my setup. -- Terry, East Grinstead, UK
  4. Namino's method is elegant and Scasper's is very clever and both have taught me some new things. But I think if I was doing the task from scratch myself I'd have just taken the most direct and (to me) intuitive approach. // RedWhiteBlue - an intuitive but inflexible method Text File Begin Process: "Test01.txt" Text File End Process Text File Begin Process: "Test01.txt" Text File End Process Text File Begin Process: "Test01.txt" Text File End Process Text Box Display: Result Macro Return <REM2:RedWhiteBlue - an intuitive but inflexible method><BTFBEG:001:000001:000001:C:\Docs\SUNDRY\Macro Express\Test01.txt><BTFEND><BTFBEG:002:000002:000001:C:\Docs\SUNDRY\Macro Express\Test01.txt><BTFEND><BTFBEG:003:000003:000001:C:\Docs\SUNDRY\Macro Express\Test01.txt><BTFEND><TBOX4:T:1:CenterCenter000278000200:000:ResultT1 = %T1% T2 = %T2% T3 = %T3% ><MRETURN> This assumes, of course, that the text file has only a smallish number of lines, say 10 or fewer. In practice I expect the file would be larger and probably of unknown length. In that case I think it should be easy enough to add a Repeat loop containing a Run Macro in Variable command. -- Terry, East Grinstead, UK
  5. I take it you've tried simply clicking the appropriate menus with the mouse, while hiding the activity? You could also try Controls; lots in Help on that topic. -- Terry, East Grinstead, UK
  6. Did you read the Help? I think it's pretty clear and comprehensive. For example, under Help > Index > Else there are: - detailed descriptions of all commands - the Sample macro link at the bottom gives a simple but useful example - the See Also... link provides further detail -- Terry, East Grinstead, UK
  7. You look at the letter and - recalling your early school classes - you try to remember what it's called. Sorry - couldn't resist! Seriously though, perhaps you didn't read jrtaylor's post carefully? He said "...I changed the icon to a letter I would recognize." As they say, the devil is in the details! -- Terry, East Grinstead, UK
  8. As you've confirmed my description of your requirement is accurate then you should simply be able to open the file with a trivial macro like the one following. You haven't specified the file's name, extension or path, or the program you are opening it with. So in this example I've assumed it's called xyz.txt in a folder called ffff and you want to run it in Notepad. Note that the macro assumes you already have the folder somewhere on your desktop, possibly minimised or inactive. // Example for tocmo0nlord // Open the file \ffff\xyz.txt in the program Notepad.exe Activate or Launch: "Notepad" OR "Notepad.exe" Macro Return And here's the code for pasting into Direct Editor. <REM2:Example for tocmo0nlord><REM2:Open the file \ffff\xyz.txt in the program Norepad.exe><LAUNCHYES3:0:0112Notepad<LAUNCH:Notepad.exe<PARAM>C:\Docs\SUNDRY\Misc\ffff\xyz.txt><MRETURN> Just adapt that to your own case. If it doesn't work you'll need to spell out - your macro (commands and actual code) - exactly what happens, with details of any error messages - your file and program details -- Terry, East Grinstead, UK
  9. OK, thanks Stan, I should have been clearer. I meant 'Where is the command(s) that is doing the copying of the selection?'. I didn't see it in the OP's macro extract. He doesn't identify the target window, so it's not fully clear to me what he's doing. Is it a text-based program (like Notepad, or the example I used, TextPad)? A web page? A program with mixture of text and graphics (and the possibility that the mouse is selecting non-text)? Etc. I would typically follow such a mouse-drag selection with a Copy, to get the text to the clipboard... BTW, both your and Kevin's examples work fine here. I use that sort of command set quite often. In fact, yours works for me without the Mouse Speed command. If I include it, then speeds as low as 1 ms work OK. But I normally use Kevin's approach, i.e. with brief delays (typically 100 ms). -- Terry, East Grinstead, UK
  10. Where is the command for doing the 'selecting'? -- Terry, East Grinstead, UK
  11. Can't you just use Activate Window as one of your first commands, to switch to the target window? If its name changes, you could adapt the method from your last thread. -- Terry, East Grinstead, UK
  12. IMO, there's not really enough detail for anyone to give you a confident answer. What steps exactly do you want the macro to perform? As a basis, describe every step you take yourself to perform the operation manually. Along these lines: 1) Open a Windows Explorer/My Computer folder called ffffffffff. 2) Locate a file called xyz.ext. This will always be the most recent file in this folder. Manually, this is done visually, or by sorting to Date Modified (Descending) and choosing the top entry. (Unless it was already in that sequence, in which case such an operation would reverse the order.] There is a a good reason why this file cannot be named in such a way that it is always alphabetically first, so that approach to its consistent location cannot be used. 3) R-click it. 4) From the R-click menu select Send To... 5) In the Send To folder left click the entry called yyyyyyyy, the name of the program (with full path and filename of zzzzzzzzzz.exe). The file cannot be run by the usual method of associating it with zzzzzzzzz.exe in Tools > Folder Options >File Types and then d-clicking the file. [Are you 100% sure of that?] -- Terry, East Grinstead, UK
  13. Another way would be to use Task Manager. Here are the basic steps I would follow to buld the macro: 1) Enter your program name after prompting, and store it in a string variable, say T1. 2) R-click an empty space on the taskbar. Here, with a 1920 x 1200 screen, the rectangle on the extreme right (including the Time display from the Date/Time icon) gives a reliable result. So the following macro opens TM // Get Memory usgae Keystroke Speed: 10 Milliseconds Mouse Speed: 1 Milliseconds Mouse Move Screen 1900, 1190 Mouse Right Button Click Delay 100 Milliseconds Mouse Move Position -90, -60 Mouse Left Button Click Delay 100 Milliseconds Macro Return <REM2:Get Memory usgae><SPKEY:0010><SPMSE:00001><MMS2:1900,1190><RCLK><MSD:100><MMP2:-90,-60><LCLK><MSD:100><MRETURN> 3) Click the Image Name column heading to sort alphabetically 4) Use a capture program hotkey (Snagit in my case) to capture all the text from that TM window 5) Paste it to NotePad or your preferred text editor 6) Use the Find or Search facility to locate the name of your program 7) Navigate across (4 columns in my case) to the Mem Usage column (in KB). 8) Copy that to clipboard and an integer variable, say N1 9) Compare N1 to your 'target', say 1000 KB and if necessary display an appropriate warning, etc. 10) Otherwise end the macro 11) Schedule it at whatever interval you think appropriate. I see from a little googling that Mem Usage includes pages that can be shared by other processes, so you must be careful not to double-count. If you're trying to find out the combined memory usage of two processes that use a common DLL, for example, you can't simply add their Mem Usage values. You don't say anything about why you're doing this or provide any background, so I'm not sure if my suggested approach is useful or not. I've assumed you want to take a 'snapshot' of a particular program's memory usage at short intervals? Presumably you've rejected the obvious idea of simply hitting Ctl+Alt+Del and checking that line in TM visually? -- Terry, East Grinstead, UK
  14. You could probably do it using TClockEx http://www.rcis.co.za/dale/tclockex/ -- Terry, East Grinstead, UK
  15. Those commands are all very basic and well described in ME's comprehensive Help. In particular, read the Index entries for Web Site and Text Type. But here's an example to get you started. This macro is called Example for jrtaylor and its operation should be clear after studying the commands and my notes below: // Example for jrtaylor // First, open the web site, using IE. Keystroke Speed: 20 Milliseconds Web Site: [url="http://pgmacros.invisionzone.com/index.php?showforum=2"]http://pgmacros.invisionzone.com/index.php?showforum=2[/url] [internet Explorer - Wait to load] // Navigate to the Login link by using the Tab key and then Enter Text Type: <TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><ENTER> Delay 500 Milliseconds // Navigate to the Username box by using the Tab key Text Type: <TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><... Delay 100 Milliseconds // Enter the username Text Type: terrypin<TAB> Delay 100 Milliseconds // Insert similar commands to enter the password, etc Macro Return If you're impatient to run this as it stands, before adapting it to your own needs, just paste the code below into an empty Direct Editor box for a new macro. <REM2:Example for jrtaylor><REM2:First, open the web site, using IE.><SPKEY:0020><HTTP2:2:T:http://pgmacros.invisionzone.com/index.php?showforum=2><REM2:Navigate to the Login link by using the Tab key and then Enter><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><ENTER>><MSD:500><REM2:Navigate to the Username box by using the Tab key><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB>><MSD:100><REM2:Enter the username><TEXTTYPE:terrypin<TAB>><MSD:100><REM2:Insert similar commands to enter the password, etc><MRETURN> Notes: - The macro goes to the ME forum site and starts to log me in. You'd do broadly the same for your financial site. - To work out how to navigate to the login link and the username box I had to follow an obvious but crucial principle: first observe exactly how I do this manually. So, for example, I found that no fewer than 14 Tabs were needed to reach the login link, and 18 to get subsequently to username. (If you were confident of the IE window always sized and positioned consistently, you could instead achieve these with mouse clicks.) - I added the Keystroke Speed command because there's a lot of text entry involved and I wanted to slow it down a bit - Even so, as happens with almost all my macros, my first few attempts failed. I got it working only after adding those various delays. Some of them might prove redundant after more methodical testing, but for a few hundred milliseconds it's of no significance in this case. One delay that seemed critical was the 500 ms; much shorter and the macro failed, probably 'running ahead of itself'. So, trial and error will often be involved! -- Terry, East Grinstead, UK
  16. Tom, You can simply use a Repeat command, with your macro called within the Repeat loop. Here's an example. This is the command structure of a macro called Macro repeated: // Run a macro mutiple times Repeat Prompt Start (Prompt for repeat count at macro play time) Macro Run: Tom Repeat End Macro Return And here is the actual code, which you can paste into an empty Direct Editor box if you want to create the macro yourself. <REM2:Run a macro mutiple times><REP3:02:Center:Center:0001:0:00:><MACRUN2:Tom><ENDREP><MRETURN> Run it with whatever activation you want. For completness, here is the macro called Tom that I used: // This is whatever macro you want to repeat Text Box Display: Message Delay 100 Milliseconds Macro Return And its code: <REM2:This is whatever macro you want to repeat><TBOX4:T:4:CenterCenter000278000200:000:MessageThis text message has been opened by your repetitive macro. Instead of this command you would insert your own. Press Enter or cllick OK to close this message.><MSD:100><MRETURN> -- Terry, East Grinstead, UK
  17. Yes, that's it. I suspect that I'll only recognise its full potential after trying some practical examples. I have many 'normal' macros at present that start from the mouse cursor hovering over a file in a Windows folder. My first thoughts for using these 'context macros' are along the lines of replacing the existing macros, perhaps with gains in simplicity/reliability. But my present r-click context menu is already very long so that approach could quickly become unmanagable. So another idea is to develop a comprehensive menu approach based on this new method. I'd r-click a file and would get a top level menu, maybe by file type - Text (TXT,INI,LOG, etc) - Image (JPG, PNG, etc) - Movie (AVI, MPG, etc) - Mapping (KML, GPX, MMO, etc) - Office (DOC, XLS, etc) etc Then, if I left-clicked one of these, the next (perhaps final) level of sub-menu would be offered, e.g, from Image - Resize to 1024 x 576 - Resize to largest possible 4:3 - Resize to largest possible 16:9 - Add to IrfanView for batch processing - Open in PSP and apply effect xxx etc I've done very little with MX menus so far, so that might take a major effort. Maybe one day... -- Terry, East Grinstead, UK
  18. Whatever you want to use it for! Any series of operations on that file. Some may be universal, others may apply only to specific file types. For example: 1) Open a JPG in your preferred image editor, edit it using 1 or more tools (e.g. automatic contrast or gamma adjustment, resize, etc) and re-save it with a new name 2) Change a file's name, adding a complex prefix and/or suffix that you use a lot 3) Add an AVI or MPEG or WMV (or any movie clip file) to the timeline of your movie editing program and make a DVD MPEG2 file from it. 4) Quickly copy or move any file to another folder (either fixed or chosen from a menu). etc, etc, etc. Your fresh post in this old thread has reminded me that after implementing Paul's demo 20 months ago I never got around to adapting it myself for the 101 applications it inspired. So yet another project goes onto the ever-growing To Do list! --------- EDITED FOOTNOTE: I've just stumbled across one potential snag to watch out for. Several of my frequently-used macros already r-click a file and then arrow down to select a particular menu entry. (When the alternative use of a specific letter is unrelaible or problematic.) The addition of a new item, like Me Macro can, of course, change the position of the target entry, requiring the macro to be modified with an extra Arrow Down command. -- Terry, East Grinstead, UK
  19. It does rather seem like an issue arising from the IE7 + Vista + MX 3.7d combination. So you really need to hear next from Stan or Kevin, plus other users with that combination. -- Terry, East Grinstead, UK
  20. Thanks, Scasper, understood. See my reply in your other thread, FWIW. -- Terry, East Grinstead, UK
  21. Scasper, My default browser is Firefox (so, as a side issue, I can't use the Wait for Web Page command, which is a pain) but I fired up MSIE6 and ran the simple macro below OK, from a hotkey scoped to IE. Web Site: [url="http://uvlink.uvu.edu/cp/home/loginf"]http://uvlink.uvu.edu/cp/home/loginf[/url] [internet Explorer] Wait for Web Page: "http://uvlink.uvu.edu/cp/home/loginf" Macro Return The login page duly appeared. Have I misunderstood, or are you saying that doesn't happen for you? Is it perhaps some IE setting? Are you using a hotkey or shortkey to activate? Note that I'm using same MX vesrion as you but XP SP2, not Vista, although I can't believe that's a factor. -- Terry, East Grinstead, UK
  22. Thanks Kevin. But can you explain that please? Why does that work? Why not just 'Notepad'? -- Terry, East Grinstead, UK
  23. Scasper, Thanks, but I don't have that option to hide inactive icons checked. (Maybe I should - the current inventory of 18 icons plus clock take up a fair bit of room, although on this 24" widescreen it's not too bad.) So that wasn't the cause. Nor it seems was it the Scroll Lock button. I've set that on again but the macro runs fine. (I have a hotkey assigned to it as well as Schedule for convenience.) So, remains a mystery, but working consistently now. Once set up, that macro is all too easy to forget! With N1 still set to the 1-4 minute range, I had it popping up at all sorts of odd times. Of course, if I happened to be in the middle of playing with another macro or whatever, it would then usually fail. Now duly disabled, until maybe I set it up for something useful. That downside will always remain, of course. So in practice I'd probably consider using XP's Scheduled Tasks facility if the application allowed. At least while I remain fairly active with MX. Thanks again for giving me the lead on this. -- Terry, East Grinstead, UK
  24. I think you will need to make a few modifications to your macro to get reliable operation. Here is my version: [color="#0000FF"]// This macro will run at random intervals, set by N1 Keystroke Speed: 10 Milliseconds Mouse Speed: 1 Milliseconds // This is where you would insert commands for your macro // My example is the following trivial one // Activate NotePad (already running) Activate Window: "Untitled - Notepad" Wait For Window Title: "Untitled - Notepad" Text Box Display: Your macro is running // Record current position of mouse, in case it's important to return it Get Mouse Position Screen: %N1%, %N2% Delay 100 Milliseconds // Open MX Editor by clicking its System Tray icon Move Mouse to Tray Icon: "Macro Express" Delay 100 Milliseconds Mouse Left Button Click Delay 100 Milliseconds // Return mouse Mouse Move Screen %N1%, %N2% // Get a random number between 1 and 100 (choose your own) which will be the interval before next run Variable Set Integer %N1% with a Random Number Wait For Window Title: "Macro Express - Macro Explorer" // Ensure Macro Explorer is displaying ALL macros (not just the last category you displayed). Text Type: <HOME><TAB> // Deselect the top macro automatically selected // Otherwise that one, which is quite likely to be the one you want to find, especially during experiments, // will be missed by the Find - which apparently ignores the starting position! // The only way I can think of to do this is to click the top entry, based on its position // To keep it simple I've assumed MX will be consistently sized and positioned the way I happen to have it at present // It should be straightforward to add code to ensure this before this part of the macro was run Mouse Move Screen 1314, 120 Text Type: <CTRLD> Delay 100 Milliseconds Mouse Left Button Click Delay 200 Milliseconds Text Type: <CTRLU> Delay 200 Milliseconds Text Type: <ALT>mh Delay 200 Milliseconds Wait For Window Title: "Find" Text Type: Run at random intervals Delay 100 Milliseconds // Open Scripting Editor for 'Run at random intervals' Text Type: <ENTER><ESC><ENTER> Wait For Window Title: "Scripting Editor" // Open its Properties Text Type: <SHIFT><TAB><ARROW RIGHT> Delay 100 Milliseconds Text Type: <ENTER> Delay 100 Milliseconds // Tab 9 times to reach te Schedule button // Note: this should already be checked Text Type: <TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB> // Open the Schedule dialog // 'Other' and 'Play Macro Indefinitely' should already be specified as checked. Text Type: <ENTER> Delay 100 Milliseconds Wait For Window Title: "Set Schedule" // Navigate to the 'Every' box and enter the random number of minutes Text Type: <TAB><TAB> Delay 100 Milliseconds Text Type: %N1% Delay 100 Milliseconds // Navigate to the 'OK' box and close Text Type: <TAB><TAB> Delay 100 Milliseconds Text Type: <ENTER> Delay 100 Milliseconds // Save the macro with its new setting, so that it will restart in N1 minutes Text Type: <CONTROL>s Delay 100 Milliseconds Restart Macro Express[/color] And here is the code <REM2:This macro will run at random intervals, set by N1><SPKEY:0010><SPMSE:00001><REM2:This is where you would insert commands for your macro><REM2:My example is the following trivial one><REM2:Activate NotePad (already running)><ACTIVATE2:Untitled - Notepad><WAITWIN2:000010:000000:Untitled - Notepad><TBOX4:T:4:CenterCenter000278000200:005:Your macro is runningDid you take a break since this message last time? ><REM2:Record current position of mouse, in case it's important to return it><MOUSEPOS:T:01:02><MSD:100><REM2:Open MX Editor by clicking its System Tray icon><MOVETOTRAY:Macro ExpressT:F:0:0><MSD:100><LCLK><MSD:100><REM2:Return mouse><MMS2:1N,2N><REM2:Get a random number between 1 and 100 (choose your own) which will be the interval before next run><IVAR2:01:06:3><WAITWIN2:000010:000000:Macro Express - Macro Explorer><REM2:Ensure Macro Explorer is displaying ALL macros (not just the last category you displayed).><TEXTTYPE:<HOME><TAB>><REM2:Deselect the top macro automatically selected><REM2:Otherwise that one, which is quite likely to be the one you want to find, especially during experiments,><REM2:will be missed by the Find - which apparently ignores the starting position!><REM2:The only way I can think of to do this is to click the top entry, based on its position><REM2:To keep it simple I've assumed MX will be consistently sized and positioned the way I happen to have it at present><REM2:It should be straightforward to add code to ensure this before this part of the macro was run><MMS2:1314,120><TEXTTYPE:<CTRLD>><MSD:100><LCLK><MSD:200><TEXTTYPE:<CTRLU>><MSD:200><TEXTTYPE:<ALT>mh><MSD:200><WAITWIN2:000010:000000:Find><TEXTTYPE:Run at random intervals><MSD:100><REM2:Open Scripting Editor for 'Run at random intervals'><TEXTTYPE:<ENTER><ESC><ENTER>><WAITWIN2:000010:000000:Scripting Editor><REM2:Open its Properties><TEXTTYPE:<SHIFT><TAB><ARROW RIGHT>><MSD:100><TEXTTYPE:<ENTER>><MSD:100><REM2:Tab 9 times to reach te Schedule button><REM2:Note: this should already be checked><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB>><REM2:Open the Schedule dialog><REM2:'Other' and 'Play Macro Indefinitely' should already be specified as checked.><TEXTTYPE:<ENTER>><MSD:100><WAITWIN2:000010:000000:Set Schedule><REM2:Navigate to the 'Every' box and enter the random number of minutes><TEXTTYPE:<TAB><TAB>><MSD:100><TEXTTYPE:%N1%><MSD:100><REM2:Navigate to the 'OK' box and close><TEXTTYPE:<TAB><TAB>><MSD:100><TEXTTYPE:<ENTER>><MSD:100><REM2:Save the macro with its new setting, so that it will restart in N1 minutes><TEXTTYPE:<CONTROL>s><MSD:100><RESTARTMACEXP:FT> ymnav: Note that during testing I set N1 to a max of 3 minutes, not 100, so remember to change it to whatever you want. Also, while I was composing this, the macro ran OK automatically a few times but just now gave an error because I had not excluded the possibility of a zero interval. So add the following directly after the random variable command: // Ensure N1 is never 0 Variable Modify Integer: %N1% = %N1% + 1 Scasper: Re my previous post about the tray icon not working here, it all now seems OK. I think it may have been because of the Scroll Lock key being on, although that might be coincidence. Thanks a bunch for introducing me to the Move Mouse to Tray Icon command, which should prove very handy! -- Terry, East Grinstead, UK
  25. Scasper, I was interested in your macro approach which uses a command I've never used myself before, Move Mouse to Tray Icon: "Macro Express". But I'm getting very erratic results with it. I had it working inconsistently for a while earlier, but now I've tried a dozen times in succession and get 'The system tray icon, "Macro Express", could not be located' every time. After that I noticed that r-clicking the MX system tray icon no longer displayed a menu. So I closed MX via XP Task Manager and re-started it. Now I have the r-click menu back, but the macro still fails with that message. Also, while the message is displayed, I note that the system tray icon has disappeared and a minimised tab for tne MX macro has appeared in my taskbar. When I abort the macro, the sys tray icon returns. Any ideas on what might be happening here please? -- Terry, East Grinstead, UK
×
×
  • Create New...