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
-
2017-01-20-121834
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
0 -
Hi Brian,
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.
PierrePublic 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
0 -
Thank you both! It's hard getting used to the implementation here. I'm still in the "figuring out how it works" phase.
-Brian0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions