Jump to content
Macro Express Forums

joe

Members
  • Posts

    1,002
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by joe

  1. These changes will maximize your loop time to about 10 seconds. By changing the loop counter (%N2%) or the delay time (currently 0.5 seconds), you can increase or decrease the loop time.

    Variable Set Integer %N2% to 1
    Get Pixel: Window Coords: 430,275 into %N1%
    Repeat Until %N1% = 1071789
      Wait Time Delay 0.5 Seconds
      Get Pixel: Window Coords: 430,275 into %N1%
      If Variable %N1% = 1071789
         OR 
      If Variable %N2% >= 20
         Repeat Exit
      End If
      Variable Modify Integer: Inc (%N2%)
    Repeat End

  2. Needs to be able to query a database to get the data

    There are no commands built directly in to Macro Express to extract data from the many different database engines out there. However, you can use Macro Express to control a script that extracts the data. There was a recent topic about this very subject. You can find it here.

     

    Needs to be activate the third party app (make it the active window)

    Macro Express does this.

     

    Needs to enter the data from the query into the third party app (with the appropriate tab sequences and enter sequences.)

    Macro Express does this.

  3. Cory -

     

    I'll bet this is what you're looking for:

     

    A majority of our clients are using Macro Express to control VBScript scripts that use ADO to access Excel workbooks as databases without the need for launching Excel. Extracting data, writing data, and so forth. But none of them have any use for Access. I imagine that the steps required are almost identical with those of Excel.

     

    So yes, you can use database techniques on Excel and Access. For that matter on text and CSV files, too! Hang on to your shorts, here's an example:

     

    On Error Resume Next
    Const adOpenStatic = 3
    Const adLockOptimistic = 3
    Const adCmdText = &H0001
    
    Set objConnection = CreateObject("ADODB.Connection")
    Set objRecordSet = CreateObject("ADODB.Recordset")
    
    objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=X:\Data\Addresses.xls;Extended Properties=""Excel 8.0;HDR=Yes;"";" 
    objRecordset.Open "Select * FROM [Main$]", objConnection, adOpenStatic, adLockOptimistic, adCmdText
    
    strSearchCriteria = "Name = 'Joe Weinpert'"
    objRecordSet.Find strSearchCriteria
    objRecordset("City") = "Cleveland"
    objRecordset.Update
    objRecordset.Close
    objConnection.Close

    The above code (let's call it "NameAddress.vbs") would:

    1. Open an existing Excel sheet named "X:\Data\Addresses.xls" as a database
    2. Open the sheet named "Main" as a table (in this example the whole table is a record set)
    3. Search the column titled "Name" for a cell that equals "Joe Weinpert"
    4. Then change a column named "City" in the same row to "Cleveland"

    Cake, baby!

     

    So how does Macro Express fit in? Simple! Look at the changes:

     

    On Error Resume Next
    Const adOpenStatic = 3
    Const adLockOptimistic = 3
    Const adCmdText = &H0001
    
    Set objConnection = CreateObject("ADODB.Connection")
    Set objRecordSet = CreateObject("ADODB.Recordset")
    
    objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=%T1%;Extended Properties=""Excel 8.0;HDR=Yes;"";" 
    objRecordset.Open "Select * FROM [%T2%$]", objConnection, adOpenStatic, adLockOptimistic, adCmdText
    
    strSearchCriteria = "Name = '%T3%'"
    objRecordSet.Find strSearchCriteria
    objRecordset("City") = "%T4%"
    objRecordset.Update
    objRecordset.Close
    objConnection.Close

    Notice the Macro Express variables? Create a macro to set variables using prompts:

    • T1 = "X:\Data\Addresses.xls"
    • T2 = "Main"
    • T3 = "Joe Weinpert"
    • T4 = "Cleveland"

    Then set a string variable, say %T10%, to everything between the CODE tags. Save it out to a file named "NameAddress.vbs" and then run it. It can be run by double-clicking on it via Windows Explorer or it can run via the Macro Express Launch Program command.

     

    Want more flexibility? VBScript files accept parameters. And to top it all off ... scripting is built into your operating system. Nothing to buy. Nothing to install. It's already there.

     

    The point is: you can do ANYTHING using Macro Express to control and run scripts. We know. We make our living at this stuff. All possible through Macro Express. Hubba hubba!

     

    Have at it.

  4. I think I understand. The macro will recognize the cursor has changed from an arrow to something else, but it can't see what that something else is because the software is using its own custom cursors, and they are not in the 21-set provided by Macro Express.

     

    Have you tried each of the 21 cursors in the set against, say, your no-drop cursor just to be sure it is not recognized?

  5. Terry -

     

    "dissemble" is such a nasty word don't you think? I think so. It means "To disguise or conceal behind a false appearance", in other words ... purposely deceive.

     

    You seem to be an intelligent person and once you learn more about Macro Express I'm sure that your input will be invaluable to all of us MX developers and users. But, don't ever accuse someone here, in my forum, of something like that again. Period.

     

    Okay ... on to the stuff that helps everyone!

     

    Incredible! Is it really so hard to admit Insight may have screwed up a bit? The only macros under discussion are the 23 I listed, from the page I gave, in the sub-section headed Samples From Insight Software Solutions. To repeat yet again, after I imported them NONE were commented. You replied that some of them were. I was obviously curious about that, and asked you which ones. You still haven't answered that simple question...

    Not sure what you are talking about. Out of the 23 macros listed, only 8 do not have comments and the rest do. Here's the list that doesn't:

    • Hide a Program
       
    • Maximize and Minimize
       
    • Menu and Question
       
    • Open Explorer Folder
       
    • Process Folder
       
    • Variable and Mouse
       
    • Counter from Run to Run
       
    • Copy and Paste Repeatedly

    Yes, it's true. Comments can and do help a great deal. I'm positive that the ones that have no comments are older ones.

     

    Let's turn to your comment "But changing MACEX.INI would not affect your system." On my system that file contains 170 lines of configuration detail about Macro Express, so I don't see where you're coming from with such a confident statement! A user could surely wreak havoc if he/she changed it in unintended ways? Using it in a demo macro for novices seems to me rather like learning to use a chain saw for tree surgery, while sitting astride a major branch

    Can't wreak havoc with something that isn't used and macex.ini is not used in Macro Express 3. Feel free to saw a way at it. It's there for the samples and whatever experimenting you would like to do with the samples.

  6. Hello!

     

    Look, I know how frustrating it can be to have questions unanswered in a public forum. But remember, even the most simplest of questions can take a fair amount of time to answer. And I've learned over the years that there are simply times, for whatever reason, that questions remain unanswered. Believe me, it happens to ALL of us. And not just in this forum. It truly does.

     

    I should reiterate at this point that this is our forum (Macros LLC / Professional Grade Macros). We support it. We sponsor it. It is NOT run by Insight Software Solutions. They are generous to take the time to read all the questions. And Kevin is great at answering them when others, such as myself, cannot. But they are, by no stretch of the imagination, responsible for what, or what does not, happen here.

     

    The answer you need might not be as easy as you think it should be, but only because of your lack of programming experience. The answer to finding a string within another string is almost the same in any programming language. You need to to a sub string search, and in Macro Express that would be the Get Position of Text in a Text Variable command. There is your place to start.

     

    The Macro Express of today, bears little resemblance to the Macro Express I started using 8 or 9 years ago. So, like, you, I'm learning something new almost everyday. Take your time. Experiment with the examples in the sample.mex file. Go through the tutorials. Read the online knowledge-base. Examine the help file. All of these things will help you. And after all, THAT is the most important thing.

  7. Don -

     

    Any ideas? Thanks.

    It could be that you need to slow Macro Express down a little. Add a Delay command of 1 or 2 seconds after the web page command.

     

    To slowdown the keyboard, add a Keystroke Speed command of, say, 50 ms prior to the section containing the TABs. This will force a 50 ms pause between each keystroke.

     

    Macro Express can outrun applications so you will need to experiment with delays to get the right flavor for your environment.

  8. I can't tell you what happened, but the results are that it sounds like your macro library was somehow corrupted. Do you have a backup?

     

    If not, you may be able to recover from a copy that gets placed in your assigned temp folder (something like "C:\Documents and Settings\You\Local Setting\Temp").

     

    Look for the latest file with a ".$$$" extension. Something like "~macexp30.$$$". They are backups that Macro Express (automatically?) generates whenever you make a change to a macro.

×
×
  • Create New...