Jump to content
Macro Express Forums

arekowczarek

Members
  • Posts

    76
  • Joined

  • Last visited

Posts posted by arekowczarek

  1. I have a form field which is pre-populated with some content. I used "get control command" to gain access to this particular field. Here's what worries me. When I try to send some text to that filed via text type - send text directly to control, the text is placed in front of the text that was already in the filed. I tried to send <DEL> and <BACKSPACE>, and even <HOME><SHIFTDOWN><END><SHIFTUP><DEL> sequences to eliminate the old content but it doesn't work reliably (time delays are not the issue - checked it).

     

    I could use the mouse (or tab through the fields) and delete the content but that's not really the approach I'd like to use. I have to populate 30 000 forms each containing 10 fileds I want to interfere with, so every second matters (the action will be repeated every month so I need an efficient and reliable solution).

     

    Is there a trick to clear the field content with the use of controls?

  2. You might make sure you're running 4.2.2.1. They have made some recent improvements for performance with arrays.

    4.2.2.1 it is.

     

    I decided to attach the two macros I used for testing so that you can check for yourself and during cleaning up the code I stumbled upon one unnecessary command that was affecting the "CR/LF" macro (I added logging each line into a txt file to check if it was working alright and forgot to remove it afterwards). Dumb me, I admit it ;) (but don't quote me, I'll deny)

     

    Anyway, I re-ran the tests, and although the Text File Process method advantage is not as big as before, it is still crushing - 5 times faster than the "CR/LF" macro.

     

    I attached the macro I used for testing and the html file that was processed.

    TEST Text file process vs caching.mex

    test.html

  3. I was speaking in generalities so of course there may be times when one needs to use files. But I'll follow the lead on the specifics in your case. Here's how I would limit my search to 4k-7k.

    Set %CR% to 0xOD (carriage return)
    Set %LF% to 0xOA (line feed)
    Start the repeat with folder (guess)
    Increment counter %C%
    Suck the file contents into %Temp%
    Split %Temp% into %Line% on "%CR%%LF%" (Now I have an array with each element one line)
    Repeat 2000 times starting at 4000 and keeping counter %C2%
     If %Line[%C2%]% contains "yada yada" (Test I need)
      Set %Output Line% to "%C%,%C2%,"some useful information" (Create a CSV line for my output file)
      Set %Output[%C%]% to %Output Line% (Store my results in an array instead of INI)
      Break
     Endif
    End Repeat
    End Repeat
    Join %Output% from 1 to %C% on "%CR%%LF% into %Temp%
    Save %Temp5 to my results CSV file
    

    I don't know why you're doing INI files but I like to save mine in TSV (CSV in this example) files. Point being save the output in an array and then at the end generate one results file instead of saving it thousands of times to thousands of files. I just wanted to give you a general idea how I approch this and avoid disk writes.

     

    I have to admit that upon seeing your idea of separating "the lines of content" I thought that it was gonna be light speed. However I ran some tests (on a 10k line .html file) and it is still about 20 times (!) faster to use the Text File Process command rather than the splitting CR/LF macro. Really odd.

    The most time consuming part of your macro was checking the %LINE% array for "yoda yoda" occurence.

     

    The reason .ini files are used is because this database was never meant to grow up to this extent. Gonna convert it to csv asap or sooner.

     

    I wonder if anyone can answer some of the questiones asked in the OT? Mainly the 100 KB file being the fastest to read from. It's bugging me, I can't sleep, I can't eat, I can't... well ok, I'm just curious ;)

     

    Thanks for the input Cory.

  4. But I think you need to ask yourself what’s the point to move this data to a RAMDisk. It’s to get it into the fast RAM, right? So why not instead just load it into RAM? IE read them into variables. Generally what I do is to set the file contents to a variable and then do my thing.

    This is what I do al the time, except it's not gonna work very efficiently with my project unless I'm doing something wrong here.

    Let's say I need to find this string:

    <p class="shortDescription"

    located in a .html file. Then, I need to copy the rest of the line to another file. But here's the catch. The string in question appears several times in the file. I roughly know which part of the file, so I know to only check lines 4000-7000 of the file (I know the string appearance I am looking for is the only one within this part of the file.

    It is easy to check the specified lines using the Text File Process.

    Now let's try to accomplish that copying the whole file content into a variable. How would you separate the 4000-7000 lines from within the variable and perform the string search only within that area?

    The only idea I could think of to determine the 4000th line area was something like this:

    Repeat Start 4000 times
    Variable modify string - Replace /CRLF/ with " "[only one]
    End Repeat
    Variable set %N[1]% integer from the position of /CRLF/.
    

    Now %N[1]% indicates where the hot content starts.

    I didn't even go deeper into this idea since it has already failed efficiency test vs Text File Process method.

     

    Sometimes in arrays sometimes finding markers in the file and massaging the string variables.

    I don't think I follow here. The arrays part.

     

    And then when I’m done write the my results back to a file in one hit. It seems to me that for what you are doing you have to read this data then save this data at least once in any case so no RAMDisk is going to help you there.

    One hit saving is a no go. All the data retrieved has to be saved into an .INI file. One section and 18 entries per one HTML file. Saving every .ini entry has to be performed using a separate command, so the file has to be read to (modified) 18 times (well not really 18 cause some of the entries are populated using another macro, but still: 1 command per 1 entry saved).

    Tests proved that if the .ini file is located in RamDisk I'm gaining huge advantage versus storing the .ini on the HDD. And by huge I mean from here o--------------------------------------------> to here. That huge :)

     

    And if everything else in between is done in variables you’re working in the fast world of RAM. IOW I’ve never seen a benefit of using a RAMDisk when I already have direct access to RAM.

    That is true/obvious, Ramdisk cannot possibly outrun the RAM itself, but as I pointed above, not everything can be performed within a variable's content. Of course this statement will cease to apply if it turns out the "array" way you mentioned above can be applied as a solution. But I need you to clear this up for me.

     

    But I really do like your experimentation. It’s so good to put things to the test and see what works. Also my server has an SSD for its OS drive and I’d be happy to run any tests you like on it. I’ve found a lot of the performance hype about SSDs a little overblown but they are way cooler than conventional platter drives.

    I sure know the are. Was using one for a while but had to sell it (my money printer got broken, but as soon as it's fixed I'm getting myself one).

     

    As for the tests, I think it only makes sense to compare the HDD vs RamDisk vs SDD performance when all the three tests are performed on a single machine. We have to keep in mind that macro performance is greatly influenced by the CPU speed.

    Even macros like this:

    Repeat Start 50000 times
    Delay 1 ms
    End Repeat
    

    will produce very different runtime results for different machines. 62 seconds on my current machine [Athlon 2x2.1 GHz).

    I appreciate you volounteered for the tests. If you're interested (or anyone else of course) in running the whole set of tests on one machine (HDD + RamDisk + SSD) I wrote a macro that basiaclly only requires setting the file directories in the macro and it's good to run.

    Depending on the accuracy level you choose, both read and write tests will take from 0.5 to 1.5 hours.

    Test results are stored in a .txt file which I'd be happy to process and dress up into charts like the tests above.

     

     

    The file attached is indeed a .rar archive. I had to change its extension to allow attaching it.

    The ancient archive of endless joy and happines.txt

  5. BTW I put my taskbar on the left side of my primary screen about 2” wide and always on top. This affords me the ability to see what the titles are for most of the windows instead of just a little icon. Also I can see 20+ at a glance. It’s a personal preference to be sure but I can’t understand why anyone would have the taskbar at the bottom of the screen if they have dual or large displays and can afford the dedication or display real-estate. I just can’t stand the extra time hunting for ‘the’ window hidden in multiple icons with the same icons.

     

    I guess that goes to me :)

    I have the taskbar on the bottom for the same reason I'm still stuck on XP. I need to run some games in maximised mode. I have to have the taskbar visible cause it won't let me start a macro if the game has focus (and it of course has if it is fullscreen, therefore the maximised mode). If I moved the taskbar I'd need to rewrite plenty of macros because the game window "extends" or "shrinks" to use all the screen it's given in maximised mode. And it does it in a very irregular way therefore it's not only a matter of adjusting the coordinates by lets say 20 pixels this way or another. Hope I made it clear enough but the behaviour of game window contents is very different from "usual programs" and it's not obvious if someone didn't stumble upon it. Resizing the game window by 1 pixel causes more hassle that anyone would think it could. Seriously.

    On my other PC that I don't use for game macros writing (bots) I also have the sidebar moved to the side [i prefer the right edge] of the screen and it *IS* much better to work with, no doubt about it.

  6. Lately I was doing lots of text file processing. And as I have even a bigger project of that type ahead of me, I was trying to find a way to speed it up. Basically I need to analyze several thousands of .html files [ranging from 50 KB to 200 KB] using text file process command and extract specific values to ONE .INI file. I thought the best way to speed the things up would be to create a RAM disk and put both .html and the .ini file there. As a matter of fact it worked - I received about 130% speed boost. But later on I got curious what part of the macro is taking up the longest and the inconsistence of short tests I run led me to creating a deeper research. Here are the results:

     

    FIRST TEST - READ SPEED:

    <VARIABLE SET STRING Option="\x00" Destination="%T[1]%" NoEmbeddedVars="FALSE"/>
    <REPEAT START Start="1" Step="1" Count="50000" Save="FALSE"/>
    <VARIABLE SET STRING Option="\x03" Destination="%T[1]%" Filename="D:\\1 KB.txt" Strip="FALSE"/>
    <END REPEAT/>
    <BEEP/>
    

    Using this macro I tested its runtime for text files of following sizes [KB]: 1, 10, 50, 90, 100, 110, 200, 1000, 10000.

    In the first stage the files were located on a HDD, in the second on a RAM disk. Each test was run three times for extra accuracy.

     

    The biggest surprise: not only the read speeds are similar for both HDD and RAM disk, but also for files 1 KB to 1000KB, files are read FASTER from the HDD (!) than the Ramdisk. For files 1000 KB and bigger there's no difference between HDD and RAMdisk.

    Next interesting thing that can be observed - for both HDD and RAM disk the top performace is achieved while working with 100 KB files. Not 90 KB, not 110 KB, exactly 100 KB. How come this is the "favourite" file size?

     

    chartsw.png

     

    SECOND TEST - WRITE SPEED:

    <VARIABLE SET STRING Option="\x03" Destination="%T[1]%" Filename="D:\\1 KB.txt" Strip="FALSE" _BACK="00FFFFFF"/>
    <REPEAT START Start="1" Step="1" Count="50000" Save="FALSE" _BACK="00FFFFFF"/>
    <VARIABLE MODIFY STRING Option="\x11" Destination="%T[1]%" Filename="D:\\dummy.txt" CRLF="FALSE" _BACK="00FFFFFF"/>
    <END REPEAT _BACK="00FFFFFF"/>
    <BEEP _BACK="00FFFFFF"/>
    

    Using this macro I tested its runtime for text files of following sizes [KB]: 1, 10, 100, 1000, 10000.

    In the first stage the files were located on a HDD, in the second on a RAM disk. Each test was run three times for extra accuracy.

     

    This looks the way it should - files are written to the RAM disk 142% - 162% faster than they are to the HDD. (the bigger the file, the bigger the difference between HDD and RAM disk write performance.

     

    Platform used for tests:

    WIN XP PRO 32

    ME PRO 4.2.2.1

    StarWind Ramdisk 5.5 [emulating 100 MB RAM disk]

    WD 500 GB 7200 RPM HDD

    Athlon x2 2x2.1 GHz

    2x1GB DDR2 800 MHz RAM sticks

     

     

    I was trying to run the test using a different RAM disk but failed to find a different freeware (likely didn't search good enough). If you can recommend one - please do, I'll be happy to re-run the tess. The StarWind RAM disk received the most credit throughout the forums and it's free therefore it was used for the tests.

    What is missing here is an SSD test but I don't have access to one atm.

     

    The general conclusions I drew from the tests:

    1. If the files that are gonna be processed (read from the disk) are smaller than 1000 KB it is better to keep them on a HDD rather than on a RAM disk.

    2. For files of any size that are going to be written to very frequently by a macro it is way better to store them on a RAM disk.

     

    I'd be glad to see some comments on the test results. If anyone can put some light on why it is faster to read files from HDD than RAM disk and why the 100 KB files are the fastest ones to be read, please do.

  7. Sorry, but I still don't follow what you mean. Is there some option for the Text Box Display command that I've missed all this time, which lets you minimise it to the Windows Taskbar? Or are you merely reducing its size and positioning it manually above the Taskbar?

     

    --

    Terry, East Grinstead, UK

     

    I think what Cory does have in mind is this:

     

    taskbardicon.png

     

    When downloading something with firefox (and I'm quite sure it's the same for other browsers) you will see a window showing the progress of a file download and its representation in the taskbar ("the taskbar icon"), also showing the progress. This way, you don't have to have the downloading window on the top to see where are you at with the file download. It would be great if it could work the same way for ME TBD.

    Minimising the window is not the priority (or necessity) here. As long as we can check the progress without bringing the TBD window to the front we are fine.

  8. It is explained in the help file. But a practical example is searching for cmd.exe. I'll bet if you type in only "cmd.exe" and check the box it will test true. This is because it’s looking for that file in the “Path” environmental variable. Open a command prompt and type “Path”. In this example cmd.exe was searched for by MEP in all of those folders. It’s a good way to ensure a command is available. Before launching it and not needing it to be in the same location every time. EG sometimes cmd.exe is in c:\windows other in c:\winnt.

     

    I'm just past reinstalling windows (yep, still XP ;) ) and I must have accidently installed the wrong version of ME (4.1.5.1). Althought the option was available in that version the help file kept silent about it.

    I downloaded the latest version of ME and it is mentioned there. However I find your example of usage easier to comprehend so thanks for clearing this up for me.

  9. Try putting a 2 second delay between the attempt to open each new site in Internet Explorer. When spending time evaluating and modifying the Define Word Take 5 I discovered that the amount of delay needed to make the macro reliable varied dramatically between browsers. On my computers Firefox needed 0.01 second delay, Opera 1, Safari 0.75, Chrome 0.01 but IE 2.0 needed 2.0 seconds.

    I even added a 5 second delay and it still keeps opening new windows. Dumb IE.

     

    Thanks for the tip Kevin

  10. Internet Options > General tab > Tabs section Settings button > "Open links from other programs in:" section.

     

    Thanks for a speedy reply!

     

     

    "New tab in the current window"* is checked. And it keeps on opening the new windows as before.

     

     

     

    *It's my translation of it, I'm using Polish language version.

  11. Is there a way to hold the <ARROW LEFT> for 1 seconds?

    It can't be done with the text type command.

    I'm not a VB or Java programmer therefore I can't resort to it. I'd think there's a way to perform this using VB/Java script (inserted using External Script command in ME). If you know either of the languages you might give it a try.

    That would be the easiest way I guess.

     

    However, when I had to write some game macros that required a key pressed down for a period of time, I used a different approach. Pretty rough... but it worked.

    I installed some customizable on-screen keyboard (similar to the one build into Windows). I was able to decrease it's size so it was reallly small and I was able to see the game window without any troubles.

     

    Instead of using Text Type command if I wanted to press "Left arrow" button, I had my macro:

    1. Move mouse over the Left Arrow position on the on-screen keyboard

    2. Mouse button down

    3. Delay 1 second

    4. Mouse button up

    This is akward, no doubt bout that, but if you don't know your way around Java or VBA, this might be the only way to simulate the key being pressed for a period of time.

  12. Didn't think specifics were needed. I've got a macro that pulls strings out of a website and puts it in Excel. I have that part working fine. In VBA for instance, in the middle of a macro, you can 'turn off screen updating'. Typically it increases performance, as well as locks the display of Excel.

     

    I am trying to run the same thing within my macro. So it can open excel, input the information, save/close the file and refocus the website without any screen updating, so the users couldn't see the information being put into excel.

     

    Thanks,

    Joe

    Excel is the key word.

    I never got to do anything with screen updating in Excel (never had anything to do with internal MS Office macros), therefore "screen updating" not used in the connection with Excel meant nothing to me. I know what you're talking about now, however I can't be of any help here.

  13. It works now. For some reason, there is a ton of blank "text types" that fill the script as it's copied. It happened at work and it happened at home when I copied your script and pasted it into the script editor.

     

    I apologize. It works.

     

    Should I submit this as a website bug?

    Hahaha....

     

    Pat

    I can't reproduce this Pat. It hasn't ever happend to me. When I copy and paste this script (any script) into a macro it never adds any empty text type commands.

    Does it happen to all the time, with every script, consistently? I can't think of a reason for it to happen... I wouldn't mind seeing a screenshot of the script with the extra commands.

  14. So, I have a script that works no problem. I would like to hide its activity though. Is there any way to pause screen updating until the macro has completed? Either with another program, or macro express pro itself?

     

    On a side note - I'm not even sure if the macro will continue working with the display frozen. Any help would be much appreciated.

    Judging by the number of replies this post received, either the problem is unsolveable or nobody knows what the problem is. I know I don't.

    Could you explain the nature of what you're doing and what you're trying to accomplish a little clearer?

  15. Hello all,

     

    I am busy with questions today.

     

    I am parsing a text file and want to grab any text that is an email address.

     

    In general, it would go something like this:

     

    If variable contains @ and .com or .net or....(other extensions) do something....

     

    My question is, is there a better way to make sure it's an email address and nothing else?

     

    Pat

     

    Guess it's you're lucky day Pat!

     

    The attached macro processes a text file and displays a TBD everytime an email address is found.

     

    Tests included:

    - local part length 1≤64

    - domain part length 1≤253

    - local part to only contain chars allowed in it

    - domain part to only contain chars allowed in it

    - domain part to contain at lest one "."

    - first or last char of local part can't be "."

    - local part not to contain ".."

    - email address length ≤254

     

    There are more conditions than that, that decide about an email address being correct or not, if you feel like adding more validation test go ahead. Refer to the website Cory provided. I think it's pretty clear in the script where certain validation test should be inserted. If not just ask.

     

    I think I had it parse on the @ and the last period.

    What about ".co.uk", "com.pl" and others? Did you create a rule for every country?

     

    I didn't put any validations test on those. It's important so it shouldn't be neglected. I'm leaving this part to you Pat. Time for you to contribute to the script ;)

     

    Test file attached is the file I was testing the macro with.

    EMAIL EXTRACTOR.mex

    test.txt

  16. It still splits it at the 1 not beteen the c and 6.

    For some reason when I copied the script, it did not copy all of it to my scrpt editor.

    But now, when you copied the the rest of it it still doesn't return

    1ac

    657

    ?

    I'm having really hard time understanding this, there's no way this macro is machine dependent. Can anyone confirm, please?

     

    Plus, you declared the variable to be a 1 in the scrpt.

    No such thing. You are apparently reffering to line #7 in the script. "1" is not a character there, it stands for the character position - first from the left.

     

    Nevertheless, Cory, Arek et. all, I would like to learn how ASCII decimals work with this script.

    Can you show me how to do that?

    Cory has much more knowledge in this topic, and he surely can explain it better if he makes time.

  17. I would go thru each character and record when it changes to a number. And I find concerting to the ASCII decimal value makes the logic easier.

    That was my first idea Cory, but I figured this would be faster. Going thru the chars cannot be avoided (well, half of the chars). So, since we are already going through the chars, why not sort them at that time? Isn't it easier to write? It doesn't require remembering how many chars are going into one string, and how many chars go into the other. But that's just my point of view ;)

  18. Thanks Arek,

     

    The string you used 1ac657 needs to be split between the c and 6 into 2 different variables.

     

    The "1" needs to be disregarded if the first character is a number so it will not split it between the 1 and a.

     

    Pat

    Did you run the macro?

     

    It should return:

    1ac

    657

    Right?

     

    It does when I run it. Does it not when you run it.... somehow...?

  19. I need to split the string in the middle and if the first character is a number, do not split it after this character rather go to the next possible "split" where letter ends and number begins.

     

    I believe that's what you're looking for:

    <VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="1ac657" NoEmbeddedVars="FALSE" _COMMENT="string to be split"/>
    <VARIABLE SET INTEGER Option="\x0D" Destination="%N[2]%" Text_Variable="%T[1]%"/>
    <REPEAT START Start="1" Step="1" Count="%N[2]%" Save="TRUE" Variable="%N[1]%"/>
    <VARIABLE MODIFY STRING Option="\x09" Destination="%T[2]%" Variable="%T[1]%" Start="%N[1]%" Count="1"/>
    <IF VARIABLE Variable="%T[2]%" Condition="\x04" Value="a" IgnoreCase="FALSE"/>
    <OR/>
    <IF VARIABLE Variable="%N[1]%" Condition="\x00" Value="1" IgnoreCase="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x06" Destination="%T[3]%" Value="%T[2]%"/>
    <ELSE/>
    <VARIABLE MODIFY STRING Option="\x06" Destination="%T[4]%" Value="%T[2]%"/>
    <END IF/>
    <END REPEAT/>
    <TEXT BOX DISPLAY Title="RESULT" Content="{\\rtf1\\ansi\\ansicpg1250\\deff0\\deflang1045{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil\\fcharset238 Tahoma;}{\\f2\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %\\f1 T[3]%\r\n\\par \\f0 %\\f1 T[4]%\\f2 \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 macro copies one character at a time from the input string, if it is a letter or if it's the first character it appends it to string#1. If it's a digit it appends it to the string #2.

     

    Am I close?

  20. OK. Sorry it took so long to get back with you.

     

    Sometimes the number part could be 4 digits, but the letter part seems to be always 3 digits. So I want to split it between the letters and numbers.

     

    So what it boils down to is, I want the macro to detect when the letters end and the numbers begin no matter the number of numbers or letters after the first number.

     

    Pat

     

    Well, if I understand correctly "2bc" is the letter part and "250" is the number part.

     

    If so what is "2" doing in the letters part? Is there always one digit in the front of the letter part?

    If thats the case would it be reasonable to assume that the pattern looks like this:

    <number><letters><numbers> ?

×
×
  • Create New...