cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Macro Help Exporting images from isodraw to a numbered folder

bfriesen
17-Peridot

Macro Help Exporting images from isodraw to a numbered folder

We export our images to a folder once completed so our other programs can see what the image is. Currently we export all of the images to one folder. This has become an issue so i have split the folder into 1000 image folders. How do I modify my macro so that it will place the image in the correct numbered folder

 

Macro export CGM to User Pictures folder
#Define variables.
Define JPGLocal as string
Define CGMLocal as string
Define SVGLocal as string
Define fileName as string
Define CMDLocal as string
Define tempLocal as string
Define tempCGM as string
Define tempSVG as string

#Define cmd.exe.
CMDLocal = "C:\WINDOWS\system32\cmd.exe"

#Define local temp Local.
tempLocal = "C:\temp\"

#Turn off possible error/warning prompts during export.
app.interaction=false

#Save file to current Local.
Save

#Define variable for file name
fileName = stripext(activedoc.name)

#Set export Local for jpg.
JPGLocal="X:\Photos\" + fileName + ".jpg"

#Export jpg.
Export JPGLocal "JPEG"

#Set temp CGM export path.
tempCGM = tempLocal + filename + ".cgm"

#Set temp SVG export path.
tempSVG = tempLocal + filename + ".svg"

#Set final cgm Local using cmd format (%variables%).
CGMLocal = "%userprofile%\pictures\" + stripext(activedoc.name) + ".cgm"

#Set final SVG Local using cmd format (%variables%).
svgLocal = "%userprofile%\pictures\" + stripext(activedoc.name) + ".svg"

#Export CGM to temporary location.
Export tempCGM "CGM"

#Export SVG to temporary location.
Export tempSVG "SVG"

#Calls a cmd window and runs a move command to move the file to the final location.
Launch CMDLocal "/c move /Y " + tempCGM + " " + CGMLocal

#Calls a cmd window and runs a move command to move the file to the final location.
Launch CMDLocal "/c move /Y " + tempSVG + " " + SVGLocal

#Turns prompts on.
app.interaction=true
End Macro

ACCEPTED SOLUTION

Accepted Solutions
bfriesen
17-Peridot
(To:bfriesen)

Got it figured out

 

JPGLocal="X:\Photos\" + left(fileName, 4) + "000\" + fileName + ".jpg"

 

This now looks at the file name and reads the first 4 numbers.

 

Bryon

View solution in original post

1 REPLY 1
bfriesen
17-Peridot
(To:bfriesen)

Got it figured out

 

JPGLocal="X:\Photos\" + left(fileName, 4) + "000\" + fileName + ".jpg"

 

This now looks at the file name and reads the first 4 numbers.

 

Bryon

Announcements

Top Tags