Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
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
Solved! Go to Solution.
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
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