Jump to content
Macro Express Forums

arekowczarek

Members
  • Posts

    76
  • Joined

  • Last visited

Posts posted by arekowczarek

  1. Tetris is a great example. Basically I need to send several keystrokes to the game.

    (keeping key stroke pressed for 5 seconds is too long)

    For example, I want to do the following commands:

     

    To do (left-> left-> change block position -> put it down)

    I would need to press the left key, left key, up key, space bar.

     

    Please teach me how to deal with this xD.

     

    Copy and paste these commands into a macro:

    <TEXT TYPE Action="0" Text="<ARROW LEFT>"/>
    <DELAY Flags="\x02" Time="500"/>
    <TEXT TYPE Action="0" Text="<ARROW LEFT>"/>
    <DELAY Flags="\x02" Time="500"/>
    <TEXT TYPE Action="0" Text="<ARROW UP>"/>
    <DELAY Flags="\x02" Time="500"/>
    <TEXT TYPE Action="0" Text="<SPACE>"/>
    

    Make sure the window game has focus before running the macro.

    I tested it on some online Tetris in Java and it works as expected. Time delays are added so you can see what's happening step by step.

    Is that what you needed? And does it work with your game?

  2. Hi,

     

    I'm a new user of macro express pro. I'm trying to create a macro where i can input keystrokes on the java game.

    I have used the capturing tool to create a script but the script commands does not play on the java game.

    Is there a way to perform this? The clicking part works; however, keyboard key input does not.

     

    Thank you,

     

    Welcome to the forum!

     

    Do you need to send a keystroke to the game or you need to simulate a key being held down for a period of time?

    If the second, it can't be done be simple sending the keystroke, but there are ways to deal with it.

    I.e. if you were playing tetris, and captured a macro in which you press left arrow and keep it pressed for 5 seconds, and then run this macro, it would only move the block one position to the left instead of moving it all the way to the left side (as it would during capturing the macro). But as I said there are ways to deal with it.

  3. I assume it fails with k = 1 for all n. And whenever n-k = 1.

    You're right. Due the algorithm I used, while calculating combinations for k=1 and for n-k=1 division by 0 occurs.

    As for k=1 - it is easy to fix, cause when k=1 the combination number equals n. As for n-k=1 I know alright why the division by 0 occurs and I will deal with this later.

     

    I'd simply get the macro to open Excel and insert n and k into the function COMBIN().

    In the future I will need to calculate combinations on different users' machines. Dynamically. The need of extra software used in the process is not really an option. The macro I wrote works just fine within the range of numbers I will need it to work. It won't work for ie. n=400 and k=390 but that's ok, I'm not gonna need to calculate such numbers, ever.

    But since the macro is written, I was just wondering how I could make the macro more varsatile, make it work with greater range of numbers. It would require a different algorithm... or I was hoping that there might exist some native procedure similar to Excel's function COMBIN() in VBA or Java or whatever language I could insert into ME script.

  4. Until now I always refered to a certain website if I needed to calculate the number of k-element combinations within n-element set.

    Today I wrote a macro that does the calculation for me. It is still hot, so there are still errors due occasional division by 0 which I am gonna deal with later, and few other shortcomings. But in general it works ok.

    The website does the calculaton somehow for any REASONABLE n and k values while my macro will fail if it needs to calculate i.e. 25! (factorial of 25) as a part of calculating the combinations number. The website is probably (for sure) using a different algorithm to do the calculations than the one I used in my script. So, can anyone tell how does calculating combinations number look like in i.e VBA or Java? I mean, is there a native procedure (or something like this) one could use, and only enter the values of n and k, or it requires writing the whole code calculating the number of combinations step by step(in a way I did in the macro below). I know the website calculator is better at avoiding situation when an integer would receive a number larger than it can store. I just wonder whether the programmer deserves the credit for it or it is just an upside of the programming language used.

     

     

    The macro attached prompts for the values of n and k and provides the result.

    combinations calculator.mex

  5. Aha! The following script is, so far, working as intended. I will continue testing. Thanks again, Arek, for pointing me in the right direction.

    You're welcome!

     

     

    You might also wanna play with this:

    <LOCK KEYBOARD AND MOUSE/>
    <GET KEY STATE Key="Control" Dest="%B[2]%"/>
    <TEXT TYPE Action="0" Text="<CONTROL><SHIFT><ARROW LEFT>"/>
    <TEXT TYPE Action="0" Text="<BACKSPACE>"/>
    <IF VARIABLE Variable="%B[2]%" Condition="\x00" Value="TRUE" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<CTRLD>"/>
    <END IF/>
    <IF VARIABLE Variable="%B[2]%" Condition="\x00" Value="FALSE" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<CTRLU>"/>
    <END IF/>
    <DELAY Flags="\x02" Time="100"/>
    <UNLOCK KEYBOARD AND MOUSE/>
    

    No "stuttering" here. The locking and unlocking of the keyboard is introduced to eliminate multiple activations of the macro (unwanted if you need a specified time interval in between).

    The problem here: The longer the delay is, the higher the chance of CTRL being left pressed down after the macro terminates and you take your finger off it. There might be a way to alter the code somehow to avoid it. Good luck!

  6. The question: How do you do it in Macro Express so that the it fires continually while holding down Ctrl + Backspace. I can't make it work; it stops working as soon as I check "Activate as soon as the keys are pressed."

     

    Edit: The most likely reason the command won't work: Control (Ctrl) is part of the activation (Ctrl + Backspace). The command sends Ctrl + Shift + Left. So my guess is that Macro Express is having trouble handling the Ctrl key...

     

    Hi Alan,

    If a Text Type command is used with a <CONTROL> to be typed out, the state of your physical CTRL key is set to UP (or FALSE if talking boolean). Even though you still have your finger down on the key! That's why you couldn't make your macro repeat.

     

    What I did is: I saved the state of the physical CTRL key before the Text Type command, and then restored it right after. Therefore the Text Type command had no impact on the state of CTRL key. Sneaky huh?

    However, that's not the end of the problems. When having the macro to [start, act, end] continuously, the only way to adjust the time interval between macro's run was to play with the Keyboard Repeat Speed Factor and Keyboard Repeat Delay Factor. I encountered some problems playing with those factors (the changes weren't applied at the right time... long story) and instead I came up with this macro:

     

    <REPEAT START Start="1" Step="1" Count="100" Save="FALSE"/>
    <GET KEY STATE Key="Control" Dest="%B[2]%"/>
    <TEXT TYPE Action="0" Text="<CONTROL><SHIFT><ARROW LEFT>"/>
    <TEXT TYPE Action="0" Text="<BACKSPACE>"/>
    <IF VARIABLE Variable="%B[2]%" Condition="\x00" Value="TRUE" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<CTRLD>"/>
    <END IF/>
    <IF VARIABLE Variable="%B[2]%" Condition="\x00" Value="FALSE" IgnoreCase="FALSE"/>
    <TEXT TYPE Action="0" Text="<CTRLU>"/>
    <END IF/>
    <GET KEY STATE Key="Control" Dest="%B[1]%"/>
    <IF VARIABLE Variable="%B[1]%" Condition="\x00" Value="FALSE" IgnoreCase="FALSE"/>
    <BREAK/>
    <END IF/>
    <DELAY Flags="\x02" Time="300"/>
    <END REPEAT/>
    

    The macro will start when CTRL+BACKSPACE combo is pressed (won't wait for release).

    However you need to release BACKSPACE after activating the macro or it will stutter (check for yourself)

    The macro will delete one word after another (up to 100 words) with 300 ms interval. To break the loop simply release CTRL.

     

    I tested it with notepad. You might need to add some logic to the macro, because it will work different with programs supporting CTRL+BACKSPACE combo natively.

     

    Why CTRL+BACKSPACE used in notepad types out "" (the empty square, I don't know the professional name for it)? If that could be disabled somehow it would eliminate the stuttering mentioned above. Or maybe it only occurs on XP?

  7. You've now introduced a new term, 'stand-alone'. You appear to be saying that the condition 'Don't wait for m2 to terminate before proceeding [with m1]' really also means '...and don't allow m2 access to the variables previously defined with "Make this variable available to macros called by this macro" '.

     

    Is that the case? If so, all would become clear. IOW, does the absence of a checkmark against 'Wait for this macro to terminate before proceeding' mean it is what you are now calling a stand-alone macro, which has the very important property (not mentioned in the dialog) of not having access to variables defined in the calling macro? In direct contradiction to the variable settings?

     

    I think macro2 doesn't have access to variables defined in macro1 (if macro1 doesn't wait for macro2) to avoid a situation, in which both macro1 and macro2 operate and have access to same variables. That could cause some mess I guess. But then again, I'm not a programmer either and I also might be looking at it the wrong way.

  8. Here is the code to differentiate single, double, and triple clicks. (Unlike my previous example, this version does not check for cursor movements.)

     

    Because the shortest available wait for left click is 1 second, there is a pause after a single or double click that some may find unacceptable. A triple click, on the other hand, is recognized almost instantaneously.

     

    I will submit a feature request for shorter wait times!

    I thought I would share my idea here as well. Two clicks will only be considered a double click if they occur one after another within certain adjustable time period (i.e. 200 ms)

    I detect double click using two macros:

     

    MAIN CLICK activated by: Mouse left click in top left screen area

    Var set integer %N[3]% to 200 // click interval [ms]
    Var modify integer: %N[3]%=%N[3]% / 10
    Var set integer %N[1]%: Set to mouse X coordinate
    Var set integer %N[2]%: Set to mouse Y coordinate
    Var set string %T[1]% to: "START"
    Var mod string: Save %T[1]% to environmental var %STOPWATCH%
    Macro Run: STOPWATCH // don't wait
    Repeat Start 100 times //loop number stored in %COUNTER%
    Var set string %T[1]% to environmental var %STOPWATCH%
    If var %T[1]% equals "STOP"
     or
    If var %COUNTER% is greater than %N[3]%
     Break
    End If
    Delay 10 ms
    End Repeat
    Var set integer %N[11]%: Set to mouse X coordinate
    Var set integer %N[12]%: Set to mouse Y coordinate
    If var %COUNTER% is less than or equal to %N[3]%
    And
    If var %N[1]% equals %N[11]%
    And
    If var %N[2]% equals %N[12]%
    //EXECUTE COMMAND FOR DOUBLE CLICK
    Delay 100 ms // Disable this and next command if you don't want the double click sent to the target (window, icon etc)
    Left mouse double-click //
    Else
    //EXECUTE COMMAND FOR SINGLE CLICK
    End IF
    

     

    STOPWATCH activated by: Run command

    Wait for left mouse click //wait at most 1 second
    Variable Set string %T[1]% to "STOP"
    Var modify string: Save %T[1]% to environmental var %STOPWATCH%
    

     

    Main macro (MAIN CLICK) is activated by mouse left click

    Main macro runs macro STOPWATCH which awaits for the second click

    If main macro waits too long for the signal from STOPWATCH that the second click occured, it breaks loop and performs actions for single click (if any)

    If main macro receives signal from STOPWATCH, and the time interval between first and last click is less than 200 ms, main macro exectutes commands for double click.

    Main macro only consider two mouse clicks to be a double-click if both clicks take place at same location.

    Time interval that separates two single clicks from a double-click can be adjusted in line #1 of MAIN CLICK macro, 200 ms by defaul.

    MAIN CLIK + STOPWATCH.mex

  9. I wish to use this macro to play wow, not complete automation, but for things like rapid-fire button presses.

    My input still required, but macro assisted.

     

    I know that WoW has the Warden thingy that... does something to detected "Unsupported Third-Party Software" and then Blizzard could ban.

     

    My question is, now I know they allow programmable keyboards and can detect those but don't ban for that, but I'm wondering if Macro Express 3/pro is detected and banned for, or do you have to be using it to fully automate gameplay? (botting)

     

    Heres the line in their terms and conditions concerning botting and 3rd party applications.

     

    To me it is clear that I'm not going to use the software to fully automate gameplay, but I'm worried they will be indescriminate about this macro software.

     

    If anyone with experience with this can chime in, it'd be very much appreciated.

     

    I'm not a WoW player myself, and Warden in fact is something that distinguishes WoW from other MMORGS. I know there were some privacy issues (I'd think mostly risen by botters heh) and the extent to which Warden can monitor a gamer system was limited. However, having over 10 million players I don't think Blizzard has enough manforce to look into each suspicious case of alleged botting and ponder over it. Therefore, if they (Warden) detect that some automation tool was used, they wouldn't bother to examine whether the act lasted 1 second or 1 hour. I think if only they find software interfering in any way for any period of time with the client they consider it botting. My opinion.

    Bad thing about WoW is, even if you set up a separate account and tried to check what and what doesn't get you banned wouldn't work, because Blizzard has a quite slow response, and you can be banned for a botting action after few months. Do they still ban your IP?

    If I was to bot WoW, the best approach I could think of is run WoW in a Virtual Machine, and have macro express operate from the outside of the VM (sending keystrokes/mouse actions to the virtual machine). Would it be enough to fool Warden? Don't know, but that's what I would do if I was to try. But that idea might only work for full automation because there might be some issues while using mouse in the game. (The mouse freaks out on user's action in some games run in VM). Don't know whether it applies to WoW or not.

  10. Wrong!

    - By default, each macro defines 4 array variables of 99 elements called C, D, N and T which are available to called sub-macros. So both macro1 and macro2 "contain" these variables

    - Because macro2 is independent (although it's called by macro1, macro1 does not wait for macro2 to complete), its variables come into existence only when it starts (whether as a result of you running it, or being called by macro1)

    - If macro2 is called by, say macro3, where macro3 does wait for macro2 to complete, then in this instance macro2's variables first come into existence when macro3 starts and are therefore shared

     

    Run m1 from the script editor using F8. You will see 3 text boxes containing the value of %T[1]%:

    The first box shows qwerty

    The second box shows blank

    The third box shows qwerty

     

    Do you follow?

     

    I'm not sure.

    So, the choice whether sub-macros will inherit variables from the main macro or not is always made at the start of main macro, depending on whether the main macro will or will not wait for the sub-macros to finish?

    I'm really not sure I understand it correctly...

     

    Anyway, why running the macro you attached gives different results while running it using F8 from running it the usual way?

  11. Agrr, so it was my dumb error! I forgot about this. Works as a charm now, I understand why it didn't before.

    Thanks!

    Hmm, on second thoughts, there's one more think I'd like to know. I am assuming that the variable T[1] is not accessible by the second macro, because macro 1 stops and it's variables cease to exist. Why adding 10 seconds delay at the end of macro 1 doesn't solve it (having the box mentioned unmarked)? In such case macro 2 is run while macro's 1 variables are still available, so what's the problem, why macro 2 can't see them?

  12. I assume you have checkmarked "Make this variable available to macros

    called by this macro" in the Properties for T[1]?

    Yes, I did.

     

    variables.png

     

    Here are the codes for Macro 1 and Macro 2 I used for testing:

     

    Macro 1

    <VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="ABC" NoEmbeddedVars="FALSE"/>
    <TEXT BOX DISPLAY Title="MAC 1" Content="{\\rtf1\\ansi\\ansicpg1250\\deff0\\deflang1045{\\fonttbl{\\f0\\fnil\\fcharset238 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %T[1]%\\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"/>
    <MACRO RUN Use_ID="FALSE" Name="MAC 2" ID="-1" Wait="FALSE"/>
    

    Macro 2

    <TEXT BOX DISPLAY Title="MAC 2" Content="{\\rtf1\\ansi\\ansicpg1250\\deff0\\deflang1045{\\fonttbl{\\f0\\fnil\\fcharset238 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %T[1]%\\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"/>
    

     

    The TB displayed by the second macro is blank on my machine. Can anyone run the two macros and see if it works for them?

     

    Now, I created two separate macros and manually (not copying) inserted exact commands as in macro 1 and macro 2. Result? It works - macro 2 displays the value of T[1].

     

    So it looks like in the macros I attached the variables don't receive global scope. But why wouldn't they?

  13. I never really understood how variables are passed from one macro to another macro. I think it's high time I finally do.

     

    According to ME help file:

    Global Variable

    A Global Variable is accessible inside the macro where it is defined and in all other macros called by that macro via the Macro Run command. It is recommended that global variables be defined in the main macro.

    For example, suppose you have macros A, B and C and A is the main macro that calls macros B and C via the Macro Run command. After defining a variable named %Address% in macro A both macros B and C can use this variable. Changes made to the value of %Address% in macro B would be available in macros A and B.

     

    So here's what I did"

    1. I created MACRO A

    2. MACRO A sets variable %T[1]% to "A"

    3. MACRO A runs MACRO B

    4. MACRO B claims that %T[1]%="" (blank, undefined)

     

    Why wasn't the value passed to macro B from macro A? What am I missing here?

  14. Windows 7 comes with XP Mode. Essentially it's Microsoft's Virtual PC software with a free license of XP. I use Virtual PC all the time as I often develop macros for clients in XP, 2000, and other versions of Windows or ones with specific environment requirements. It's a great addition to MEP in many respects but one that's not completely obvious to most is that you can have several open and macros running in them unattended without taking over your machine and making you unproductive. VM's (Virtual Machines) Are for all intent and purposes real machines that have their own IP addresses on the network and everything. I highly recommend any serious macro writer look into it.

    I have been a VM user for about a year now. But I don't use the MS virtual PC. I was testing it last year and the main problem I encountered - it refused to use graphic card's resources, therefore no gaming on VM was possible. I found VMware Workstation a way better solution for virtualization. Sure it's not free, but at least it works as expected. Even if MS fixed it since then, I will still stick to VMware product, cause there's more configaration options available in it.

    Then again, not all macros written for "real" PC will work on a VM. As far as games are concerned (and in my case they are), pixel colors in the VM can vary from the pixel colors on the "real" pc.

    So, if I don't need to use a VM, I don't, cause in my case it always requires modifiactions to the macros. Plus using mouse in games run on VM is a disaster... I prefer to turn on another machine and worry about the electricity bill rather than worry about the modifications. That of course only applies to not-so-often used macros. When I had to run a macro 24/7 for a month, I used 4 VMs on one PC, each doing same thing, and it was worth the hassle.

     

    I am quite sceptical about the use of Win OS built-in apps. There's always a correspondent (?) application somewhere on the net that is better. It applies to Virtual PC, Remote Desktop, Disk defragmenter, Windows Media "Disaster" Player, and having read what Paul wrote few posts ago, also to the backup utility. Some people could add IE to the list too. Sometimes the correspondent apps are freeware, sometimes they are not, but they are out there.

  15. I checked my VM for XP and you're right, you can't specify seconds in it. Just one more reason 7 is better.

    The reason I never switched to win 7 is that my Tetris macro only runs on win XP :D

     

    Now seriously. I was considering switching to win 7 when it was released last year. However a friend of mine that already was using it said that ME doesn't work right on it. Among other things, reading a pixel color off the screen was taking considerably longer (it was by no means hardware issue). I don't remember whether it was ME 3.x or ME PRO. Anyway, since I read pixels on daily basis I decided to stick to XP until a performance fix is applied. I never really got around this problem later, don't know whether it was the OS fault or ME compatibility issue, quite sure it's long gone now, isn't it?

    Another thing that keeps me from changng the OS is I have loads of macros that would need slight (but still) adjustments to work with any new OS UI. I just don't have time to do it.

  16. Anyone able to reproduce and/or suggest an explanation please?

    Do you guys get this error every time? I did about 100 trials. Sometimes the calc was closed 30 times in a row with no error, sometimes the error occured 3 times within 5 trials. I did no calculations in any of the trials, so it has nothing to do with it.

    I wonder why there's no error handling designed for this error (in the command window "on error" tab)?

  17. unfortunately it doesn't work with this macro!

    I truly didn't see this coming! Does the dialog not pop up at all or pops up with the name part empty? Anyway, no hope in this method.

     

    If nobody recognises the macro you might consider doing this:

    Export 100 macros to one .mex file. Open it in a text editor and look for phrases from the TBD i.e. "This macro will pose a question".

    1. If you find this string, export 50 macros to one file and 50 to another. And repeat process untill you get like, I don't know, 10 macros, you then should easily find the macro.

    2. If the first hundred didn't contain the phrase, export another batch of macros.

    You just have to make sure not to export the macro 'Multiple Choice DEMO' along with the others.

     

    Now I know it's as lame as it can get, no NASA scientist would ever use it, but it sure does work.

  18. Can anyone identify it please?

    Hi Terry,

    My best guess is you can identify it yourself :) Here's how:

     

    You probably have disabled the dialog informing you when you cancel a macro. So first, enable it.

    Preferences > General > Dialogs > Inform the user when a macro has been cancelled.

    Now, trigger the macro that you wanna find the name of. Cancel the macro (by shortkey or right click the running man). A dialog with the name of the macro cancelled should pop up.

     

    Hope it helps.

  19. Agreed. It's exactly the sort of sloppy programming I'd have expected (not properly testing fringe conditions), so it's disappointing that I'm not disappointed!

    Thanks Paul, reporting now.

     

    If anyone needs a quick work-around here's one:

    1. Append " " <space> to the input string before splitting

    2. Split string

    3. Right trim the last* sub-string created from splitting

     

    *If your input string looks like this "a.b.c.d", you only have to worry about "d"

     

     

     

    This issue has been assigned the tracking number [iSS9261]

  20. I am having a problem splitting a string into two other strings. I found that if we have a short input string looking like this: "a.b" and we wanna split it at "." , "b" will not get saved. If we change the "b" to "bc" in the input string, it will work just fine, saving "a" to one string, and "bc" to another.

     

    Can anyone confirm before I report it?

  21. MEP produces -9.5 when asked to round -9.60000000000001 to a single decimal point. This answer is simply wrong - the correct response is -9.6.

    You should report this as a bug.

    I reported it, but haven't been assigned a tracking number yet.

     

    OT: Is the tracking number only for using as reference when contacting ISS or I can enter it somewhere on their website to see what progress has been made on a particular issue?

  22. You can use the Windows Task Scheduler to get down to the second.

    I don't have access to Vista or Win 7 that you use Cory, but on Win XP I can only adjust the scheduled time down to the minute.

    If Koon is running a Windows 7 or Vista (if the second level accuracy applies for Vista too) then your idea is way better than mine. And he probably is cause XP is "a little" out-dated and only stubborn people like myself keep on using it :)

  23. I don't know why it would be different for sure but it might be hardware and OS. I have a Windows 7 64 bit machine and that might have an effect.

    I have Win XP 32 bit, so this might be it.

     

    I understood the problem is not connected to ME itself. I am accepting the fact that sometimes, for some values I might get the slight error and thanks to your throughout explanation I do know what it's caused by.

     

    I'm probably being a little to inquisitive now and should probably let go, but:

    Why the calculation performed on same values in two different macros would give different results?

    The macro I attached always returns the -9,60000000000001 (on my machine). If I preset the values of the two decimals in a brand new macro the result I get is "-9,6".

     

    Normally I would just round the output to 1 decimal place. I only need 1 decimal place accuracy anyway. But it gets tricky here.

    -9,60000000000001 rounded to 1 decimal place returns -9,5 instead of -9,6. I know because the number is negative ME will round it to the larger value but I would expect the choice should be made between -9,6 and -9,7 (because -9,60000000000001 is somwhere between the two numbers). Odd.

    I did some testing and found that ME would even round -9,6 to -9,5 ! In this case rounding negative numbers is just a bad bad idea :(

×
×
  • Create New...