Jump to content
Macro Express Forums

Cory

Members
  • Posts

    4,207
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by Cory

  1. When I want to see if a file changes I use HTTP Methods which you can do in an external script. The HTTP request will get you the whole file but there's a method that will only return the headers called "HEAD". The response headers usually have a "Last-Modified header. I just did one on my websites logo and I can see it was last modified on "Sun, 28 Feb 2021 00:24:18 GMT". I would cast that in the script to a decimal or longest-to-shortest text date format and compare. With this you can see if a file has changed without having to download it. 

    If you don't want to do an external script, you could download the file and check it's metadata for a creation date tag. 

  2. Oh, I often post two code boxes, one for the command text and one for the actual commands so others can easily copy and paste useful commands into their macro. But if it's more than a few lines, I recommend creating a demo macro that is  as simple as possible to demonstrate your problem, export it to a MEX file and upload that file as a message attachment. Also things like variable definitions, scopes, activations and more are preserved which will not come across be copying the commands. The easier you make it for us, the more help you will receive. 

  3. Or try this... 

    Create a macro that focuses the BricsCAD window then types a letter. If the letter ends up in the command box every time, then there's no need to use controls. But try different states of BricsCAD first. Like try being in the drawing space, menus, or whatever before execution of the macro. 

    Sorry, but I don't have the application so I don't know what it takes to get to the command line control in BricsCAD. 

  4. What options do you have to run a script in that program? I was skimming this article and a script can be run from the command line. But if there's any other options, check those out.

    Assuming the SCRIPT command can only be run from the command line, I'd have MEP focus the command line control and send text to it to run the script. 

    Do you have experience with the Windows Controls commands? Some find the concept difficult to understand at first, but it's the best way to do things in MEP. Many people here avoid them, but in this case it's going to be hard to make sure the command line control is focused after the script runs and it is probably difficult to do that without. 

    In BrisCAD start the Get Control command and click the Launch Utility. In the Capture Window Control box click the little purple crosshairs and drag it around your BrisCAD. See if when you hover over the command line box if it gets it's own highlighted red box around it. 

  5. Looks simple enough to create in MEP. Do you understand how to create the lines in MEP?

    Can you edit attributes also? 

    Are the blank line you hitting the Enter key to accept a default? You might consider typing in the values explicitly if so in case any of them are 'sticky'. By that I mean remembering  your last selection. Because someday you might choose something different in one of those and hose yourself when you later run the script.

  6. Attached is a simple macro to illustrate ASCII File Process to create a script file with a sample input and output. I can't remember the syntax in AutoCAD so I'm just going to make up one. You can change the text to whatever you want. Say the command to create a line was the word "Line" followed by the coordinates of both ends. The idea being this would be just like what the user woudl type into the command box and can be run at once as a script in AutoCAD. The input file is a few lines with the X and Y of the ends of the lines. E.G. the first one would create a line from 1,1 to 2,2. You could make multiple lines per input row also. Whatever you need. For simplicity I just made the output file have an "-out" suffix. This could be somehting prompted for or done more properly later. 

    Lines.mex Lines.txt Lines-out.txt

  7. You could save the source information as a tab file and edit the tab file in Excel. There's no reason to keep it in the native Excel format unless yo need formulas and such. But even then, MEP can do that math for you. 

    If I wanted to use MEP I'd copy the block properties from the tab file, mentioned above, using ASCII File Process and have MEP create output the command sequence to a text file. Then have MEP run the file as a script, then delete the file for you. Whether it's one or a thousand, it woudl work. The main reason I say that is speed and timing. MEP is unaware of when things finish so you either have to add much delays for each command or handle errors when it goes to fast. By making a script, AutoCAD will do it as fast as possible and you will have no timing issues to deal with. 

     

×
×
  • Create New...