Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file that plays same trail file on multiple parts

Status
Not open for further replies.

infinitevox

Mechanical
Aug 5, 2014
5
Hi!
I registered here to ask this question. I've been working on it off and on for a week and can't quite figure out where I'm going wrong.

I'm going to have about 100 parts coming through that I need to populate parameters for (and a couple other tasks).
So I recorded a trail file that will do the tasks. I tested it independently and it works no problem.

I then wrote a batch file that will go through the directory I give it (where the parts are located), it will export the list of parts to a text file.
Using this list, I set up a FOR loop to replace the part number in the trail file at each iteration.

The problem I'm running into is this:
When the batch file directs Creo to open a file, I get this message:
Cannot find C:\Users\uh345d\Desktop\AutoCreo\Backup\PA.txa C:\Users\uh345d\Desktop\AutoCreo\Backup\Test_Folder\%%a

Basically, Creo is trying to open that as a single file, instead of opening %%a (Part from list) and running PA.txa (Trail File)
I tried inserting pro_wait as well, as it was a separate command I ran across that may or may not help :p

Here is my code:
@ECHO OFF
ECHO Brought to you by: ME
:: Prompts user for the directory
set /p pathName=Enter the File Path of the folder:
set /p username=Enter your username:

:: 1. Change to the location set above
:: 2. List all files in that directory and store in a text file on desktop
cd %pathName%
dir /s /b *.* > c:\users\%username%\desktop\list.txt

:: 3. Opens Creo then runs 'for loop' to run script against each file in list.txt
:: This sets and populate parameters
:: 4. Add -g:no_graphics to run in non windows mode
for /f "delims=" %%a in (c:\users\%username%\desktop\list.txt) do ("c:\Program Files\PTC\Creo 2.0\Parametric\bin\parametric.bat" pro_wait "C:\Users\%username%\Desktop\PA.txa %%a")

Pause

Any help would really be appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor