How can I add default FileName in File.saveDialog() function in scripting?

Contributor ,
Feb 06, 2020 Feb 06, 2020

Copy link to clipboard

Copied

How can I include default file name in saveDialog scripting?

File.saveDialog("Title","Save As Type:*.png");
TOPICS
How to , Resources , Scripting

Views

1.2K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Feb 07, 2020 Feb 07, 2020

Thank you so much. It helped. I was asking for saveDlg. so I modified your code like below and it worked.

 

new File("Default File Name").saveDlg(["Title"],["PNG Files:*.png"]);

 

Thank a lot.

Likes

Translate

Translate
Community Expert ,
Feb 07, 2020 Feb 07, 2020

Copy link to clipboard

Copied

the file object has a openDlg method. It differs from the class method
openDialog() in that it presets the current folder to this File object’s parent folder and the current
file to this object’s associated file.

 

new File("path/to/defaultFile.txt").openDlg([prompt][,filter][,multiSelect]);

 

(also works when the file does not exist)

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 07, 2020 Feb 07, 2020

Copy link to clipboard

Copied

Thank you so much. It helped. I was asking for saveDlg. so I modified your code like below and it worked.

 

new File("Default File Name").saveDlg(["Title"],["PNG Files:*.png"]);

 

Thank a lot.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 18, 2021 Aug 18, 2021

Copy link to clipboard

Copied

Is there a way to make this work on MacOS? I think this only works on windows...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 14, 2022 Sep 14, 2022

Copy link to clipboard

Copied

LATEST

It works the same. Just tested.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines