Prompting for file save then using the path
This should be super easy, but I'm new to this simplescript stuff (not new to vb programming though).
What I want to do is prompt the user to save an image, have them save it as a tif, then use the path and automatically save a jpeg at the same time with the same file name. I cannot figure out how to prompt for a save path and then get whatever path is selected back.
Can someone get me started? Point me in the right direction?
Thanks,
-Brian
What I want to do is prompt the user to save an image, have them save it as a tif, then use the path and automatically save a jpeg at the same time with the same file name. I cannot figure out how to prompt for a save path and then get whatever path is selected back.
Can someone get me started? Point me in the right direction?
Thanks,
-Brian
0
Answers
Brian --
Attached, please find
2017-01-20-121749.txt
Within this file, you will find two functions:
textBox_Folder_DoubleClick
button_SaveImage_Click
The first prompts the user for a FILE using the WINDOWS EXPLORER
The second uses a FILE NAME built from DIALOG BOX ELEMENTS to save an IMAGE in a TIF FILE.
While this code will not CUT / PASTE into your PROJECT (because it references DIALOG BOX ELEMENTS from my PROJECT) it should be an example of one way to tackle your challenge.
I hope this information is helpful.
-- Matt
Here is a short macro to do this. You'll notice the code command which allows the code to remain designer compatible while allowing custom code.
Pierre
Public Function Save2Files() As SimpleScript Save2Files = New SimpleScript Dim image1 As McImage ' Variable will be set in code command Dim jpegFile As String With Application.DocumentCommands.ActiveImage(Save2Files) .Run(image1) End With With Application.DocumentCommands.SaveAs(Save2Files) .Run(image1) End With With Automate.ScriptingCommands.CodeCommand(Save2Files) If .Run() Then ' User Code Here jpegFile = image1.File.FullPathName.ToLower.Replace(".tif",".jpg") End If End With With Application.DocumentCommands.SaveAs(Save2Files) ' Set output JPEG file .Filename = jpegFile .Run(image1) End With End Function
-Brian