1. TOMAZ KRALJ
  2. PowerBuilder
  3. Saturday, 8 January 2022 17:42 PM UTC

Hello,

 

PB 2021 1288

 

I create datastore in application and would like to save this datastore as PDF document. At the time of creation of datastore I already know name of filename in which I want to save datastore, but I don't know folder. S I ask user for folder with:


value = GetFileSaveName("Savew as  PDF",ls_path, ls_filename, "PDF", "PDF file (*.PDF),*.PDF," +" PDF files (*.PDF), *.PDF")

 

everything ok, but I would like that in GetFileSaveName window the name of file is already present, user only have to select fofder in which he want to save file.

Is there any option for this?

 

Regards

Tomaz

 

 

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 9 January 2022 00:48 AM UTC
  2. PowerBuilder
  3. # 1

I think I once managed to do something similar and show "*.pdf" already filled in, so maybe you could fill in the complete filename instead of "*.pdf". See: https://community.appeon.com/index.php/qna/q-a/how-to-get-dw-1-saveas-pdf-true-to-open-in-a-specific-directory?limitstart=0#reply-29630

I know it worked, but I also vaguely seem to remember that 'later' when trying to do something similar it no longer worked. Maybe due to having upgraded to a superior version of Appeon?

As Brad said, why not use the GetFolder() function. You could maybe show the FileName in the Title something like.

"Choose a folder where you want to save " + ls_myFileName

regards.

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Saturday, 8 January 2022 18:20 PM UTC
  2. PowerBuilder
  3. # 2

Hello, Tomaz -

Assign a value to the pathname and filename return values before calling the GetFileSaveName function, as shown in the following code sample:

Constant ULong OFN_CREATEPROMPT       = 2^0
Constant ULong OFN_EXPLORER           = 2^1
Constant ULong OFN_EXTENSIONDIFFERENT = 2^2
Constant ULong OFN_FILEMUSTEXIST      = 2^3
Constant ULong OFN_HIDEREADONLY       = 2^4
Constant ULong OFN_LONGNAMES          = 2^5
Constant ULong OFN_NOCHANGEDIR        = 2^6
Constant ULong OFN_NODEREFERENCELINKS = 2^7
Constant ULong OFN_NOLONGNAMES        = 2^8
Constant ULong OFN_NONETWORKBUTTON    = 2^9
Constant ULong OFN_NOREADONLYRETURN   = 2^10
Constant ULong OFN_NOTESTFILECREATE   = 2^11
Constant ULong OFN_NOVALIDATE         = 2^12
Constant ULong OFN_OVERWRITEPROMPT    = 2^13
Constant ULong OFN_PATHMUSTEXIST      = 2^14
Constant ULong OFN_READONLY           = 2^15

Integer li_rc
ULong   lul_flags
String  ls_initdir, ls_pathname, ls_filename

ls_initdir  = "C:\MyDocuments"
ls_filename = "DefaultFilename.pdf"
ls_pathname = ls_initdir + "\" + ls_filename
lul_flags   = OFN_EXPLORER + OFN_HIDEREADONLY + OFN_LONGNAMES + OFN_OVERWRITEPROMPT

li_rc = GetFileSaveName("Save As PDF",ls_pathname,ls_filename,"pdf", &
   "PDF files (*.pdf)",ls_initdir,lul_flags)

MessageBox("Results","RC = "+String(li_rc) + &
   "~r~nPathname = "+ls_pathname + &
   "~r~nFilename = "+ls_filename)

Please note the path name you supply will NOT be the initial path/folder the user sees when the Save As dialog window opens, and the user will be able to specify a different filename, but the filename you supply will be filled in initially.

Regards, John

Comment
There are no comments made yet.
Brad Mettee Accepted Answer Pending Moderation
  1. Saturday, 8 January 2022 17:51 PM UTC
  2. PowerBuilder
  3. # 3

Have you tried using the GetFolder function?

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.