Jump to content
Macro Express Forums

stevecasper

Members
  • Posts

    570
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by stevecasper

  1. Two quick suggestions:

     

    1. Make sure your log files are not too large. This can slow things down quite a bit. You may be using a different folder but by default the log files are stored here:

     

    [My Documents]\Insight Software\Macro Express\Macro Logs\

     

    2. To see if the lag is with the activation or somewhere inside your macro, put a Sound File command at the top of your macro. When you hear the sound, you know the macro is activated.

     

    Please let us know what you discover. If you continue to have trouble please contact the Support people at Insight Software Solutions.

     

    (I guess that was really three suggestions.)

    Thanks for the suggestions, Kevin.

     

    1. I usually clean out my log files every day (sometimes several times each day), so I don't think that is causing the problem.

     

    2. I hesitated to insert any sound files in my macros, as I can't use headphones and didn't want to annoy my co-workers with incessant beeping, but today it's just me (for some irritating reason), so I inserted a Beep command at the beginning of the two previously mentioned macros.

     

    The lag appears to have stopped. It's possible that it's just the "luck of the draw" so-to-speak, as it is an inconsistent bug. But I'm going to go ahead and leave the beeps in place for now (until other people decide to come to work, at least).

     

    If this works as a bandaid for the lag, that's swell, and yet so very odd.

  2. I ran into a similar problem which I found my problem:

     

    I ran the test in the post indicated in the reply. I added a BEEP at the beginning of the macro. I get the BEEP immediately but the dialog box lags by a few seconds.

     

    I found where the problem lies.

     

    My original code was:

     

    Variable Restore: Restore Text Variables

    Variable Set String: Prompt for value

     

    When I move Variable Set String above the Variable Restore, the problem disappears. Evidently the Variable Restore has some long delay.

     

    Unfortunately I need the Variable Restore before the Variable Set String for the macro to perform correctly.

     

    Jeff Cleveland

     

    Hmmm... I haven't had a chance to play with the "BEEP" test yet (I'll give it a whack on Monday). But the Variable Restore won't be the issue on my machine. I've eliminated all my Variable Save/Restore commands.

  3. I have a macro that immediately brings up a dialog box that I enter control information into. The last version of MEP that I have been using in 4.0.1.1. When executing the macro in 4.0.1.1 the dialog box comes up immediately. In 4.1.0.1 the dialog box comes up very slowly. I cannot use 4.1.0.1 because it takes so long. Fast execution of this macro is essential to my operations.

     

    I have returned to using 4.0.1.1

     

    Jeff Cleveland

    Sounds like you are experiencing the lagging macro problem that I brought up in this post.

  4. How are you determining that a macro isn't doing anything while Mr. Green's running? Variables window? Task Manager? Other?

     

    Defining how you're looking at the issue will allow it to be replicated on other machines--or determine that it's all in Steve's machine's head... :)

    The only thing I can really do to determine that the macro isn't doing anything is by observation.

     

    One of the macros that is most often affected by this lag begins by performing a series of text types. When I run the macro and Mr. Green appears, but no text typing occurs, I make the observation that the macro is lagging. If I wait long enough, the Text Types do, eventually, occur. I'm convinced that it is a lag in the macro, not a lag in the machine's buffer, because if I wait a while and then try cancelling the macro (either by right clicking Mr. Green, or pressing the Pause key - which I have set to abort macros), Mr. Green stays up for a bit, and eventually dies without the text types happening. I would imagine if the delay were in the buffer, the typing would occur eventually even without the macro still running.

     

    The other macro primarily affected by this lag begins by reading several registry values, then it sets a number of text variables, and finally pops up a Multiple Choice menu. I can't say for certain that the lag is happening before the registy values are read, but it is certainly happening before the Multiple Choice menu launches.

     

    I've begun logging all commands on these two macros, so I can try to track down the point of the lag, but since the macro remains running, even if cancelled, and the commands don't seem to be logging until the macro stops running, I have not been able to verify the point of the lag. Just in case that wasn't clear, let me try an example:

     

    I run the macro that eventually opens the Multi-Choice.

    The lag begins.

    I cancel the macro.

    Checking the Log shows nothing.

    Mr. Green disappears.

    Checking the Log now shows commands up to the Multi-Choice menu.

     

    So where did the lag occur?

     

    If nobody else is experiencing it, it's almost certainly my machine, or a combination of my machine and MEP. It's not a huge problem, and doesn't happen terribly often, but it is rather annoying when it does occur.

  5. Hey everybody,

     

    I need to know if I'm the only one experiencing this problem (I wouldn't be surprised, since my work computer is way awesome!)

     

    Ever since the latest MEP upgrade, I've had an inconsistent issue with macros launching. I'll press my hotkeys to get the macro going, and I'll get the little green running man in the task bar indicating that the macro is running. And then I'll wait. I haven't timed it with a stop-watch, but the average wait before the macro actually does anything is approximately 15-20 seconds.

     

    I can't duplicate it with any consistency, but it seems to be more laggy with some macros than with others. The two most-consistently problematical macros don't have anything in common within the first few lines. One of them reads registry values then pops up a multiple choice menu, the other performs a series of Text-Types.

     

    Other macros don't seem to be affected at all.

     

    Before I make an official bug report, can anybody else cite similar delays or lagging issues?

     

    Thank you!

  6. You can in Sheet2, select A1:A300, entry an array formula, =Sheet1!$A$1, then press CTRL+SHIFT+ENTER.

    Eric... you are a genius! Lifesaver!

     

    I did end up just building a macro that did exactly as I explained in my original post, but this information will save me the trouble when I need to build/modify spreadsheets in the future.

     

    Thank you VERY much!

  7. Hey gurus.

     

    I have a not-very-MEP-related question, but since I know many, if not most, of the posters on this forum are savvy on numerous applications, I was hoping to get a really quick Excel assist.

     

    I am building a relatively basic spreadsheet, but I'm having a logistical problem. Here's a very simple example of what I'm trying to do:

     

    Sheet 1, Cell A1 = 100

    Sheet 2, Cells A1:A300 = Sheet 1, A1

     

    In other words, I need each cell of a 300 cell long column in Sheet 2 to match the contents of Sheet 1, A1.

     

    The simple answer is just to drag-duplicate the entire Sheet 1 A column and then drag-duplicate the Sheet 2 A column. The problem with that is that I have other information in the A column that I can't move out of the way (not conveniently, anyway), and also, because I want to be able to manipulate all the information in Sheet 2 by simply making a change to Sheet 1, A1.

     

    Traditionally, I've just copy and pasted the =Sheet1!A1 text into each cell that needs it, but for a column 300 cells (or more) it is an ugly burden that I'd like to avoid.

     

    So if there is a trick to be able to paste =Sheet1!A1 into a range of cells all at once, I'd be grateful for the knowledge.

     

    Thank you for being patient with my non-MEP request.

     

    Worse comes to worst, I'll build a macro that does:

    Repeat start = 300 times

    Text Type =Sheet1!A1

    arrow down

    Repeat End

     

    Hey look! That's ME related! phew!

  8. The more reports we have, the better we are able to track down the actual cause of the issue, so it is preferable to have multiple reports of the same crash. Sometimes issues that seem to be the same problem are actually multiple issues while one issue may cause several different problems across the program. Once we receive the reports, we will associate them together in our bug tracking software so when the issue is fixed, you should only receive one notice instead of multiple notices.

    Great, thank you. I'll be sure to continue reporting the crash, then. Thanks again!

  9. Steve's code is good but it can be simplified:
    Variable Set String %T1% "1"
    Variable Set String %T1% from Prompt
    Variable Set Integer %N1% to 10
    Variable Set Integer %N1% from Prompt
    
    Variable Modify String: Pad Left %T1%  // pad left with spaces to make the length equal to %N1%
    Replace " " with "0" in %T1% // change spaces to 0's
    Text Box Display: Final Result

     

    <TVAR2:01:01:1><TVAR2:01:02:FWhat number would you like to prefix 0s to?FFCenter:Center><IVAR2:01:01:10><IVAR2:01:02:FHow many digits should your number be once the 0s have been added?FFCenter:Center><REM2:><TMVAR2:14:01:00:%N1%:000:><TMVAR2:21:01:01:000:000: 0><TBOX4:T:1:CenterCenter000278000200:000:Final Result%T1%>

    D'OH! That's brilliant! Why didn't I think of that!

     

    Now I have to go in and simplify all the macros using that function.

     

    Hmm... nah, they work just fine. But in the future, I'll know a better way!

     

    Thanks, Kevin!

  10. I have a specific crash that happens several time a day. When the crash happens, ME automatically offers to report the crash with pertinent details.

     

    My question is this: Should I go through with it every time? Or is once enough?

     

    Part of me figures that the more instances of the crash that are reported, the more information ISS will be able to glean from the problem, increasing the likelihood of them being able to find the cause and fix it.

     

    Another part of me doesn't want to be annoying.

     

    Anybody out there have any advice on this?

     

    Obviously, Kevin, Stan, Chris, etc. who actually work at ISS, your input would be the most valuable; but I know Terry reports a number of bugs, as well as Cory, so if you guys know what ISS's preference is, and you see this question first, please let me know.

     

    Thanks evwybuddy.

  11. ******** Since Posting as below I have played with the macro and worked it out **********

     

    Again Cory THANKS it works great

     

    Eno

     

    ******************************************************************************

    Cory, I was looking for something like this, So Thanks.

    What I would like and don't know how to do it is have the choice of setting the number that it outputs with as many or as few zeros as I need

    ie: 001 or 00000000001

     

    Like GRichard I also need it as simple as possible, or as you kindly did before and posted a link for a download of your macro.

     

    Thanks Eno

    Hi Eno,

     

    I don't believe Cory monitors this particular forum anymore (he's now primarily found on the ME Pro forum), however, what you

    want to do is fairly easy. I don't have a great deal of time to go over everything in this particular post, but I can show you how

    to set a macro to add as many or few 0's to the beginning of a number as you desire.

     

    This exact code probably won't be what you need for your macro, but it will help you understand the logic necessary to do what

    you need, so you can build it using the technique shown.

     

    Scripting Editor:

    Variable Set String %T1% "1"
    Variable Set String %T1% from Prompt
    Variable Set Integer %N2% from Length of Variable %T1%
    Variable Set Integer %N1% to 10
    Variable Set Integer %N1% from Prompt
    Variable Modify Integer: %N3% = %N1% - %N2%
    Variable Set String %T2% ""
    Repeat with Variable using %N3%
     Variable Modify String: Append "0" to %T2%
    Repeat End
    Variable Modify String: Append "%T1%" to %T2%
    Text Box Display: Final Result

    Direct Editor

    <TVAR2:01:01:1><TVAR2:01:02:FWhat number would you like to prefix 0s to?FFCenter:Center><IVAR2:02:12:1><IVAR2:01:01:10><IVAR2:01:02:FHow many digits should your number be once the 0s have been added?FFCenter:Center><NMVAR:02:03:1:0000001:1:0000002><TVAR2:02:01:><REP3:05:000001:000001:0003:0:01:><TMVAR2:07:02:00:000:000:0><ENDREP><TMVAR2:07:02:00:000:000:%T1%><TBOX4:T:1:CenterCenter000278000200:000:Final Result%T2%>

  12. Why don't you just convert the integer value to hex and store that in a string var? You can do the math, it's just like long division, or you could fire up the windows calculator (calc.exe) invisibly and use the controls to convert. Pure blue for instance is 16711680 and if you convert it to hex it's FF0000 (Blue=FF, Green=00, Red=00). FYI I leave off the 0x prefix which denotes the number as hexadecimal based for clarity. You now just need to rearrange the hex triplets to 0000FF because the integer pixel color is in BGR, not RGB. Easy. But if it were me I would just do the math. Simply divide by 16 iteratively until zero and record the remainders which will occur in reverse order. For your number 14851196 I get:

    14851196/16=928199 R12 (12 in integer is C in hex)

    928199/16=58012 R7 (7)

    58012/16=3625 R12 ©

    3625/16=226 R9 (9)

    226//16=14 R2 (2)

    14/16=0 R14 (E)

     

    So that's E29C7C but remember the integer value appears to be in BGR not RGB so just rearrange the triplets to 7C9CE2. In case you didn't know the hex value is the concentrations of the components red green and blue in values of 0-255 which is 00-FF in hex. EG pure blue is 0000FF manging 00 of red, 00 of green, and 255 or FF of blue.

    D'oh! I was gonna say that! ;)

  13. well i opened ME today, and ALL the macro i hd been working are GONE.

    no explanation, but the macros and catagories all dissapeared AFTER

    running thee samples.nex file.

     

    eatc7402

    The Samples.mex file is a separate file from the one you were most likely building your macros in. You should search through your Macro Express folder to find the .mex where your work was saved. Unless you saved it somewhere else. In which case, you just have to look there.

     

    I've been confused lots of times by missing ME files that weren't lost, just misplaced... by me.

     

    It's scary, but what really sucks, is when your hard-drive crashes, and the last time you backed your macros up on your external drive was 2 months ago... and now you have 2 months worth of tweaks and improvements that just <poof!> and disappear.

  14. well i manged to get focus but the control does not seem to react to typing...

    ive changed to the following but theres nop reaction to the 'enter'

    text...

     

    Activate or Launch: "Jasc Paint Shop Pro" OR "psp.exe"

    // wait for aadvertising window to disapper

    Wait Time Delay 5 Seconds

    Text Type: <SHIFT>S

    Delay 0.5 Seconds

    Get Control %C1% (Resize: )

    Wait for Control %C1% to gain focus

    Text Type:<ENTER>

    Delay 1 Seconds

     

    eatc7402

    In the macro text you provided just now, you've removed your Set Focus command. That is going to cause you some problems.

    Make sure you are setting the focus in your macro. That might fix your problem.

     

    Some other observations:

    When you say "advertising window" in your Remark code, I presume you are referring to the Splash screen that opens when you

    first launch PSP.

     

    If you are launching from scratch, you will need to open a file before you will be able to open the Resize window. So, you'll either

    need to add code into your macro to open a blank Image file, or you will need to open an already existing image (jpg, gif,

    etc.).

     

    I built a macro that does what I think you're trying to do.

     

    Of course, mine is built without knowing where you are setting your %C1% control, but it works just fine regardless of where I set

    it on the Resize window.

     

    Here is the Scripting Editor Text (basic):

    // If PSP Is Already Running, There Will Be No Splash Screen to Wait For.
    If Window Title "Jasc Paint Shop Pro - " is running
     Variable Set String %T1% "Skip Delay"
    End If
    Activate or Launch: "Jasc Paint Shop Pro" OR "psp.exe"
    // When Launching PSP, This Delay Will 'Pause' The Macro Till the Spash Screen Has Gone.
    If Variable %T1% <> "Skip Delay"
     Delay 5 Seconds
     Text Type: <CONTROL>n
     Wait For Window Title: "New Image"
     Text Type: 8<TAB>11<TAB>i<ENTER>
     Wait Text Playback
    End If
    Text Type: <SHIFT>s
    Wait For Window Title: "Resize"
    Get Control %C1% (Resize: Button)
    Set Focus to %C1%
    Text Type: <ENTER>

    Here is the Direct Editor Text (you can copy and paste this directly into a blank macro to create this macro in your system)

    <REM2:If PSP Is Already Running, There Will Be No Splash Screen to Wait For.><IFOTH:04:2:Jasc Paint Shop Pro - ><TVAR2:01:01:Skip Delay><ENDIF><LAUNCHYES3:0:0112Jasc Paint Shop Pro<LAUNCH:C:\Program Files\Jasc Software Inc\Paint Shop Pro 7\psp.exe><REM2:When Launching PSP, This Delay Will 'Pause' The Macro Till the Spash Screen Has Gone.><IFVAR2:1:01:2:Skip Delay><DELAY:5><TEXTTYPE:<CONTROL>n><WAITWIN2:000010:000000:New Image><TEXTTYPE:8<TAB>11<TAB>i<ENTER>><WAITPB><ENDIF><TEXTTYPE:<SHIFT>s><WAITWIN2:000010:000000:Resize><GETCONTROL2:01:PSP.EXE:#32770Resize001:1Button><SETFOCUS:01><TEXTTYPE:<ENTER>>

  15. Im attempting to set focus to a control with no luck... using the following.

    Doesnt seem to work.

     

    Activate or Launch: "Jasc Paint Shop Pro" OR "psp.exe"

    Text Type: <SHIFT>S

    Get Control %C1% (Resize: )

    Set Focus to %C1%

     

    the Resiize control does get activated correctly, but i cant to get the

    focus on it to perform furthur operations.

     

    eatc7402

    You most likely need a delay between your Text Type command and your Get Control command.

     

    I don't know which version of PSP you're using, but I just tested your script using PSP 7, and it worked exactly as I expected it would. Which is to say, it didn't work until I added a .5 second delay after the Text Type command. It would probably work consistently with a shorter delay or with a window specific delay (such as: Wait for window title: Resize).

  16. Not trying to do anything with the number except display it in a text box from a variable.

    In the mouse locator color of a pixel is shown in both hex and decimal. I prefer to us the hex version,

    when a variable is displayed in a text box it is in decimal and harder to remember.

     

    Jimmy Lyon

    So you are using the Get Pixel Color command, is that right? There is no HEX variable in MEP, so Integer is the only option for saving the pixel color.

     

    Though, I can certainly see an opportunity for a feature request ( http://macros.com/requestfeature.htm ) allowing the user to select a Text variable to save the Hexadecimal color, as opposed to using the Integer variable default.

  17. hi thanks for the response.

     

    actually what i want is to know how to write a macro that can loop through the files in a directory.

     

    "open file window" to get file name and continue with other macro steps.

     

    (the part which mouse cursor move up and down in open file window and stop macro when everything finished.)

     

    --------------------------------------

    I've tried 'repeat folder' codes.

    It will loop through all files but its more like a a screenie of all files.

     

    I would like to run one file each time.

    If I understand you correctly, you just want the names of the files. You don't actually want to open the files. In your original post you said you want to use Excel to open the files, but now it looks like you only want the file names. Forgive me if I'm still mistaken. It would really help to have more information about what it is exactly that you are trying to do.

     

    If my understanding is right, then this is quite a bit easier, and can be done using Text Type commands to use the file short-cuts.

     

    Example: For many applications Alt+F will open the File drop-down menu. Ctrl+s will save an open file. I think you'll find that the combination Alt+f+m will "Rename" a file in an explorer window.

     

    So, if I have understood you, you've got your directory window open and a list of files. You want the macro to go through the files and read the names of each file - and perhaps rename the files.

     

    If that is the case, then you can do something simple like this:

     

    1. Open the directory - through Windows Explorer, for example - and navigate to the folder which contains the files you want to read/rename.

    2. Run a macro that performs the following functions:

    • Text Type: <ALT>fm - this will open up the selected item and highlight its name.
    • Clipboard Copy - Now the name of that item is on the clipboard.
    • Set Text Variable from Clipboard - this will put the name of the item into the T variable of your choosing (i.e. %T1%)
    • Now you may use Macro Express manipulate the T variable, using commands such as "Modify Text Variable" to append text to the variable (among other things you could do).
    • Once you've finished modifying the selected variable, you can use the Text Type command to type %T1% (keeping with the example). This will cause the macro to type over the name of the selected file, thereby renaming it.
    • Next the macro will need to perform a Text Type <ENTER> command in order to complete the change (essentially saving the new file name)
    • Finally, the macro can use a Text Type <ARROW DOWN> command to move on to the next item.

    You could incorporate all of these commands into a Repeat Loop so that you only have to run the macro once and it will process through all of the files in the selected directory. Of course you'll either need to count the number of items before-hand and set the repeat loop to only process that number of files, or build some additional logic into the macro so that it can detect automatically when it has reached the end.

     

    I've used macros like the one I have described above to rename photographs after moving them to my PC from my camera, since the camera gives them ridiculous names like 9003596626843.jpg which means nothing to me. Or music tracks from CDs that have complex track-names like: Evanescence_Open Door_Track 1_All That I'm Living For.mp3

     

    I have a macro that strips all the underscores (_) and replaces them with spaces. Get's rid of the band name and the album name, removes "Track", and leaves me with: "1 All That I'm Living For.mp3"

     

    Again, this may still not be what you are trying to do. If not, please provide a clear picture of what it is you are attempting, so that we can help more effectively.

  18. hi,

     

    i'm very new to macro express.

     

    would like to ask

     

    If i have 10 files in a folder.

     

    one.xls

    two.xls

    three.xls..... so on

     

    I would like to find a way to repeat the process (using excel to open):- to open the 1st file and type some text, save, continue with the 2nd file. (i wan the mouse to know which file i have copied and continue the next one till all files have been done.)

     

     

    Thanks in advance for any help.

    Opening an .xls and typing into it is a pain. There is a much easier way to do what you are trying to do, through the Text File Process and/or ASCII File Process commands.

     

    I recommend reading the Help files for these items. Also, if you haven't already done so, download the Samples.mex file from the Macro Express website (it should actually have been included automatically when you downloaded Macro Express), and run Process text file as well as Process a CSV delimited file to see how these macros work. I'd also suggest picking those macros apart (as well as any of the other sample macros) in order to get a really good idea of how Macro Express macros work, and how to build your own.

     

    If you run into any trouble, which can happen easily enough when you're first starting out, we're happy to help in this forum. We just need more details about exactly what it is you are trying to do. If you can give examples, and even post some of the code you've already written so we know where you are in the process, it can really help us to help you.

     

    You might also want to check out other posts in this forum that may be able to help you with this task. Recently I helped somebody else do something very similar to what it looks like you're trying to do. Check out post Need help creating macro for google search funtion.

  19. Is it possible to activate a macro with mousewheel up or mousewheel down?

    Not intrinsically, as far as I can tell.

     

    Of course, if you have software for your mouse that allows you to program your mouse-wheel ups-and-down to mimic keystrokes, then it should be possible to set a macro to launch based on those keystrokes, thereby allowing you to activate a macro with the mouse-wheel movements.

  20. any luck with fixing that macro so far?

    OK, I did some tests and saw what I believe was wrong. I forgot to add a relatively important line of text that actually caclulated how many previous numbers

    were in the "Random Number" file.

     

    I've fixed that, and run over 100 successful tests with values ranging from 0-50.

     

    I do have one caveat about this macro that I didn't mention before, but probably bears mentioning.

     

    When you're setting the value for how often a number is allowed to repeat, you may want to set the If Variable 1 digit higher (in this iteration of the

    macro it would be %N5%).

     

    For example:

     

    With the command: If Variable N5 = 5

    Then

    If the previous 5 numbers were 1, 2, 3, 4, 5

    Then the next number could be 1

     

    If you don't want 1 to be a possibility, set the If Varibable N5 = to 6.

     

    Ok, here's the adjusted macro. It really should work. If not, let me know and I'll take another look.

     

    // %N1% Random Number
    // %N2% Maximum Value of Randomly Generated Number
    // %N3% The Length of Variable T1
    // %N4% The Length of Variable T2
    // %N5% The Quantity of Previously Generated Numbers on File
    // %N7% The Position of the First Blank Space Within T3
    // %N8% The Length of Variable T3
    // %T1% Text Variable Holding Last 5 Random Numbers. Used For Comparison With N1/T4 (New Number)
    // %T2% A Duplicate of T1, Used to Calculate Quantity of Previous Numbers
    // %T3% Another Duplicate of T1, Used For the Same Purpose
    // %T4% The Text Variable Conversion of N1 (Randomly Generated Number). Used To Compare With T1.
    // %HOMEDRIVE%%HOMEPATH% - Essentially represents C: Drive and your default folder.
    // This may be different for every computer, so I used these defaults because they should work for anybody.
    Variable Set Integer %N2% to 50
    Repeat Until %T1% <> %T1%
     If File Exists "%HOMEDRIVE%%HOMEPATH%/Random Number"
    Variable Set String %T1% from File: "%HOMEDRIVE%%HOMEPATH%/Random Number"
    Variable Modify String: Trim %T1%
    Variable Set Integer %N3% from Length of Variable %T1%
    Variable Modify Integer: Inc (%N3%)
    Variable Modify String: Pad Right %T1%
    Variable Set String %T2% "%T1%"
    Replace " " with "" in %T2%
    Variable Set Integer %N4% from Length of Variable %T2%
    Variable Modify Integer: %N5% = %N3% - %N4%
    If Variable %N5% = 8
      Variable Set String %T3% "%T1%"
      Variable Set Integer %N7% from Position of Text in Variable %T3%
      Variable Modify String: Delete Part of %T3%
      Variable Modify String: Trim %T3%
      Variable Set Integer %N8% from Length of Variable %T3%
      Variable Modify Integer: Inc (%N8%)
      Variable Modify String: Pad Right %T3%
      Variable Modify String: Save %T3% to Text File
    Else
      Variable Modify String: Save %T1% to Text File
    End If
     End If
     Variable Set Integer %N1% with a Random Number
     Variable Modify Integer: Convert %N1% to text string %T4%
     If Variable %T1% does not contain variable %T4%
    Variable Set String %T4% "%T4% "
    Variable Modify String: Append %T4% to Text File
    Break
     End If
    Repeat End
    Variable Set String %T1% from File: "%HOMEDRIVE%%HOMEPATH%/Random Number"
    Text Box Display: This Text Box Represents The Rest of Your Macro

    <REM2:%N1% Random Number><REM2:%N2% Maximum Value of Randomly Generated Number><REM2:%N3% The Length of Variable T1><REM2:%N4% The Length of Variable T2><REM2:%N5% The Quantity of Previously Generated Numbers on File><REM2:%N7% The Position of the First Blank Space Within T3><REM2:%N8% The Length of Variable T3><REM2:%T1% Text Variable Holding Last 5 Random Numbers. Used For Comparison With N1/T4 (New Number)><REM2:%T2% A Duplicate of T1, Used to Calculate Quantity of Previous Numbers><REM2:%T3% Another Duplicate of T1, Used For the Same Purpose><REM2:%T4% The Text Variable Conversion of N1 (Randomly Generated Number). Used To Compare With T1.><REM2:%HOMEDRIVE%%HOMEPATH% - Essentially represents C: Drive and your default folder.><REM2:This may be different for every computer, so I used these defaults because they should work for anybody.><IVAR2:02:01:50><REP3:08:000002:000001:0001:1:01:T1><IFOTH:01:2:%HOMEDRIVE%%HOMEPATH%/Random Number><TVAR2:01:04:%HOMEDRIVE%%HOMEPATH%/Random NumberT><TMVAR2:01:01:00:000:000:><IVAR2:03:12:1><NMVAR:08:03:0:0000001:0:0000000><TMVAR2:15:01:00:%N3%:000:><TVAR2:02:01:%T1%><TMVAR2:21:02:01:000:000: ><IVAR2:04:12:2><NMVAR:02:05:1:0000003:1:0000004><IFVAR2:2:05:1:8><TVAR2:03:01:%T1%><IVAR2:07:13:3: ><TMVAR2:11:03:00:001:N07:><TMVAR2:01:03:00:000:000:><IVAR2:08:12:3><NMVAR:08:08:0:0000001:0:0000000><TMVAR2:15:03:00:%N8%:000:><TMVAR2:17:03:00:000:000:%HOMEDRIVE%%HOMEPATH%/Random NumberF><ELSE><TMVAR2:17:01:00:000:000:%HOMEDRIVE%%HOMEPATH%/Random NumberF><ENDIF><ENDIF><IVAR2:01:06:%N2%><NMVAR:05:01:0:0000004:0:0000000><IFVAR2:4:01:8:T4><TVAR2:04:01:%T4% ><TMVAR2:20:04:00:000:000:%HOMEDRIVE%%HOMEPATH%/Random NumberF><BREAK><ENDIF><ENDREP><TVAR2:01:04:%HOMEDRIVE%%HOMEPATH%/Random NumberT><TBOX4:T:1:CenterCenter000278000200:000:This Text Box Represents The Rest of Your MacroCurrent Number: %N1%
    
    Previous Numbers: %T1%>

  21. Is it possible to activate a macro with "keypad enter" and/or "backspace" key? If not, can it be added as a feature in the next version?

    Backspace can be used to activate a macro in Macro Express Pro (Macro Express 4.x)

     

    Enter cannot be used to activate macros in the 3.x series and not so far in Macro Express Pro. To submit a feature request, please use the form at:

     

    http://macros.com/requestfeature.htm

  22. there seems to be a problem with the macro. it usually only leaves 4 numbers in the random file. if i execute the macro a lot of times, at some point, a lot of numbers get added--and it continues to add thereafter. im using random numbers beyond 10. it seems to be due to the length of the double digit numbers vs the single digit numbers. the problems starts to happen after a single digit number gets added amongst the double digit numbers. can this be fixed?

    Yes, it can be fixed. I'll take a look at the code and see if I can debug it. It was working for me, but then I may have tweaked something during a test that didn't get un-tweaked. I can't do it right now, but I'll try to get to it at some point this week-end.

  23. cool thanks. :) would it be any more difficult to make the macro not repeat the previous 5 numbers, instead of just 1?

    This should do it.

     

    I had to re-write a good portion of the macro, so a lot of the variables in this one don't correspond to the variables used in the previous version.

     

    For example: N3 is no longer the "maximum" value, N2 is. Just something to keep in mind as you play with it.

     

    Oh, one more thing. If you want to increase the quantity of generated numbers before a repeat is permitted, you'll want to change the command line:

     

    If Variable %N4% = 5

    Just change the 5 to something else... If you increase it, then later decide to decrease it, you will need to either: a) Write some code within the macro that will

    eliminate all but the last however-many-you-want-to-keep numbers, or b ) Simply delete the Random Number file and let the macro start from scratch (my

    personal choice).

     

    // %N1% Random Number
    // %N2% Maximum Value of Randomly Generated Number
    // %N3% The Length of Variable T1
    // %N4% The Length of Variable T2
    // %N5% The Position of the First Blank Space Within T3
    // %N6% The Length of Variable T3
    // %T1% Text Variable Holding Last 5 Random Numbers. Used For Comparison With N1/T4 (New Number)
    // %T2% A Duplicate of T1, Used to Calculate Quantity of Previous Numbers
    // %T3% Another Duplicate of T1, Used For the Same Purpose
    // %T4% The Text Variable Conversion of N1 (Randomly Generated Number). Used To Compare With T1.
    // %HOMEDRIVE%%HOMEPATH% - Essentially represents C: Drive and your default folder.
    // This may be different for every computer, so I used these defaults because they should work for anybody.
    Variable Set Integer %N2% to 10
    Repeat Until %T1% <> %T1%
     If File Exists "%HOMEDRIVE%%HOMEPATH%/Random Number"
    Variable Set String %T1% from File: "%HOMEDRIVE%%HOMEPATH%/Random Number"
    Variable Modify String: Trim %T1%
    Variable Set Integer %N3% from Length of Variable %T1%
    Variable Modify Integer: Inc (%N3%)
    Variable Modify String: Pad Right %T1%
    Variable Set String %T2% "%T1%"
    Replace " " with "" in %T2%
    Variable Set Integer %N4% from Length of Variable %T2%
    If Variable %N4% = 5
      Variable Set String %T3% "%T1%"
      Variable Set Integer %N5% from Position of Text in Variable %T3%
      Variable Modify String: Delete Part of %T3%
      Variable Modify String: Trim %T3%
      Variable Set Integer %N6% from Length of Variable %T3%
      Variable Modify Integer: Inc (%N6%)
      Variable Modify String: Pad Right %T3%
      Variable Modify String: Save %T3% to Text File
    Else
      Variable Modify String: Save %T1% to Text File
    End If
     End If
     Variable Set Integer %N1% with a Random Number
     Variable Modify Integer: Convert %N1% to text string %T4%
     If Variable %T1% does not contain variable %T4%
    Variable Set String %T4% "%T4% "
    Variable Modify String: Append %T4% to Text File
    Break
     End If
    Repeat End
    Text Box Display: This Text Box Represents The Rest of Your Macro

    <REM2:%N1% Random Number><REM2:%N2% Maximum Value of Randomly Generated Number><REM2:%N3% The Length of Variable T1><REM2:%N4% The Length of Variable T2><REM2:%N5% The Position of the First Blank Space Within T3><REM2:%N6% The Length of Variable T3><REM2:%T1% Text Variable Holding Last 5 Random Numbers. Used For Comparison With N1/T4 (New Number)><REM2:%T2% A Duplicate of T1, Used to Calculate Quantity of Previous Numbers><REM2:%T3% Another Duplicate of T1, Used For the Same Purpose><REM2:%T4% The Text Variable Conversion of N1 (Randomly Generated Number). Used To Compare With T1.><REM2:%HOMEDRIVE%%HOMEPATH% - Essentially represents C: Drive and your default folder.><REM2:This may be different for every computer, so I used these defaults because they should work for anybody.><IVAR2:02:01:10><REP3:08:000002:000001:0001:1:01:T1><IFOTH:01:2:%HOMEDRIVE%%HOMEPATH%/Random Number><TVAR2:01:04:%HOMEDRIVE%%HOMEPATH%/Random NumberT><TMVAR2:01:01:00:000:000:><IVAR2:03:12:1><NMVAR:08:03:0:0000001:0:0000000><TMVAR2:15:01:00:%N3%:000:><TVAR2:02:01:%T1%><TMVAR2:21:02:01:000:000: ><IVAR2:04:12:2><IFVAR2:2:04:1:8><TVAR2:03:01:%T1%><IVAR2:05:13:3: ><TMVAR2:11:03:00:001:N05:><TMVAR2:01:03:00:000:000:><IVAR2:06:12:3><NMVAR:08:06:0:0000001:0:0000000><TMVAR2:15:03:00:%N6%:000:><TMVAR2:17:03:00:000:000:%HOMEDRIVE%%HOMEPATH%/Random NumberF><ELSE><TMVAR2:17:01:00:000:000:%HOMEDRIVE%%HOMEPATH%/Random NumberF><ENDIF><ENDIF><IVAR2:01:06:%N2%><NMVAR:05:01:0:0000004:0:0000000><IFVAR2:4:01:8:T4><TVAR2:04:01:%T4% ><TMVAR2:20:04:00:000:000:%HOMEDRIVE%%HOMEPATH%/Random NumberF><BREAK><ENDIF><ENDREP><TBOX4:T:1:CenterCenter000278000200:000:This Text Box Represents The Rest of Your MacroCurrent Number: %N1%
    
    %T1%>

×
×
  • Create New...