1

I currently have about five thousand 2D drawings, under many directories on one server, and all of them have a .prt extension. These files were created in the 90's using a software called CADKey. Unfortunately... the .prt file extension is not compatible with brand new software so I cannot open until I save it as a .dwg file in the old CADKey software. We were talking about bringing somebody to go through and open each drawing and export it to a .dwg format but, I wondered if there was a way to automate this process. I am not asking anyone to write me a script that does this, I just need some guidance because I don't know how to approach this problem. I need to know what tools and languages I need to learn in order to accomplish this.

So far I have found a way to cleverly manipulate all the code writing(or so I think). I have used a tool that created a text file with all the locations on my server that have a file with the extension .prt. Once I know how to write the script file that can open the drawings and export them... I will dump the text into excel and use a find and replace command to write the rest of my code.

Basically - I need to know what tool or language i can use to create a script that will open a file at any given path and then export it with a new file extension at the same given path.

The computer is running Windows XP.

3
  • why do you have to convert it to a .dwg file, why not .jpg or .png? Apr 7, 2014 at 21:36
  • The .prt file is likely vector based, and the .dwg after export is also vector based but in a format that other programs can open as well. Anyway, whether he needs .dwg or not is totally not part of the question. He needs a way to mass-convert files.
    – LPChip
    Apr 7, 2014 at 21:59
  • That's right... I need these .dwg files because they are parts with dimensions that I will use to build 3D models with... so, starting with a format that has those dimensions is necessary.
    – user313770
    Apr 7, 2014 at 22:30

1 Answer 1

1

There are various ways to do this and various languages too.

VBScript could do this, although it will probably be harder to learn.

AutoIt or AutoHotkey both are simple macro scripting programs which have a very simple syntax based language that will do it nicely for you too.

I've worked with both programs and in this case, I think AutoIT will have the advantage for what you want to do.

You should look towards using the keyboard to execute everything (easiest)

Your script could even alt-tab to notepad which has all the files, copy one row with a filename, alt-tab back to the program, send the alt key, then navigate the menu to open a file (unless there's a shortcut key that'll work) Then paste the content of the clipboard into the filename dialog and send an enter to load that file. Add a wait so the loading can be completed, then use the menu to export it again, and add another wait. Be sure to wait sufficient time so you're sure the loading and saving will be done before the next part in the script can finish.

You get the idea. Let it go past your list until the end. You can even count each loop and when you reach like 1000 files, you can stop. You probably know how many rows your textfile has, so it'll be easy to loop that many times.

4
  • I tried using a program I found called SendKeys. It was similar to what you just mentioned. I had difficulty opening a drawing at a specified location on the server because the menu bar for locating the file is a drop down menu versus an open search path that i could just paste a server address into.
    – user313770
    Apr 7, 2014 at 22:35
  • To explain it a little better... when I use the hotkeys to open the file... I can't just paste the server location to go find my file. Under the location to search for my files there is a drop down menu vs. an open search path(i don't know what it's called). When I say open search path, I'm trying to express it like searching for a path with my web browser, I can tab up to that dude and paste my location. It seems that I would literally have to navigate through that drop down menu to find it. I haven't used AutoIt. When I get back to it, I'll try what you've said with AutoIt. i'll try it.
    – user313770
    Apr 7, 2014 at 22:40
  • Can you post a screenshot of your open dialog? Also, Auto-IT allows you to find out the location of a dialog, and send relative mouseclicks, so you can use that in combination with sending keystrokes to open the file. Auto-IT can also work with the text in the clipboard to strip the path from the filename.
    – LPChip
    Apr 8, 2014 at 13:16
  • You may be able to tab into the dropdown, and use the arrow keys to navigate through the dropdown. Also, why is it only letting you save in predetermined locations via a dropdown? That's odd.
    – yurisich
    Apr 8, 2014 at 22:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .