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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

macro to export cgm to users pictures folder

bfriesen
16-Pearl

macro to export cgm to users pictures folder

What does the code need to look like? Folder location would be C:\users\username\pictures\, how does it change for each individual user as the username changes.

Macro export CGM to user pictures folder

# recorded with Arbortext IsoDraw 7.3

  app.interaction=false

  Save

  Define final2 as string

    final2="X:\Photos\" + stripext(activedoc.name) + ".jpg"

    Export final2 "JPEG"

  app.interaction=true

  app.interaction=false

  Save

  Define final as string

    final="C:\users\username\pictures\" + stripext(activedoc.name) + ".cgm"

    Export final "cgm"

  app.interaction=true

End Macro

Thanks

Bryon

1 ACCEPTED SOLUTION

Accepted Solutions

Check to ensure you have a C:\temp folder on your computer. It's pretty standard but...

This is also assuming you used macro exactly. If not, please post the contents of your macro.

View solution in original post

4 REPLIES 4

If I understand, you want the following line to vary depending on who is running the macro. Correct?

     final="C:\users\username\pictures\" + stripext(activedoc.name) + ".cgm"

If I'm understanding, I do not believe there is a way to capture the user name. There is a 'system' type command.

Try this as an alternative. Hopefully the comments all make sense.

Macro myExports

    #Define variables.

    Define JPGLocal as string

    Define CGMLocal as string

    Define fileName as string

    Define CMDLocal as string

    Define tempLocal as string

    Define tempCGM 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 final cgm Local using cmd format (%variables%).

    CGMLocal = "%userprofile%\pictures\" + stripext(activedoc.name) + ".cgm"

    #Export CGM to temporary location.

        Export tempCGM "CGM"

       

        #Calls a cmd window and runs a move command to move the file to the final location.

        Launch CMDLocal "/c move /Y " + tempCGM + " " + CGMLocal

       

        #Turns prompts on.

        app.interaction=true

End Macro

Thanks Trevor, I am getting an error log that states

MacDon_macros.ismexport CGM to User Pictures folder

The file '%ls' is not open. "Export tempCGM "CGM""

Thanks

Bryon

Check to ensure you have a C:\temp folder on your computer. It's pretty standard but...

This is also assuming you used macro exactly. If not, please post the contents of your macro.

Thanks for the help. I did not have a temp folder at that location. But it seems to work as expected now that I do.

Thanks for your expertise and help. It is much appreciated.

Bryon

Top Tags