1. Gregory Rusak
  2. PowerBuilder
  3. Wednesday, 1 September 2021 22:43 PM UTC

PB2021 R1 build 1288

I can't seem to find a way to have the dw_1.SaveAs('', PDF!, TRUE) open the Save As dialog window in a specific directory - it always just goes to the current directory.

I even tried to put a ChangeDirectory(ls_initdir) before calling the SaveAs, but it still always opens to the current folder and not the one I had tried to change to.

I have also tried a work-around with putting GetFileSaveName ( "Save As", ls_null, ls_null, "pdf", "PDF Files (*.pdf),*.pdf" , ls_initdir) before the call as well, with no luck.

Anyone any ideas?

Thanks in advance.

Greg

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 2 September 2021 08:50 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi,
It doesn`t seem like a good idea, to pass twice the same variable ls_null in you function call.

Try the code I post below. (you`ll have to change the initial value of ls_initialDir (c:\temp), to the default directory of your choice).
After you fill in a filename in the dialog when you run the code, ls_path will hold the path+filename and ls_file only will hold the file name.

string ls_path, ls_file, ls_initialDir, ls_title
int li_rc

ls_title = "Save as ..."
ls_initialDir = "c:\temp"
ls_path = ls_initialDir + "\*.pdf" // adding *.pdf, will make "*.pdf" appear in the "filename", but is not necessary. The extension will be added when you close the window anyway.

// passing in 32770 to get an Explorer style dialog instead of the outdated windows 3.11 version:
li_rc = GetFileSaveName ( ls_title, ls_path, ls_file, "PDF", "PDF Files (*.pdf),*.pdf, All Files (*.*),*.*", ls_initialDir, 32770)

regards

Comment
  1. Miguel Leeuwe
  2. Tuesday, 7 September 2021 21:32 PM UTC
Maybe this would be a good candidate for an enhancement request on the Support site or by sending an email to product@Appeon.com.

regards.
  1. Helpful
  1. Julie Jiang @Appeon
  2. Wednesday, 8 September 2021 01:00 AM UTC
Thanks Miguel and Gregory. We are now logging down this enhancement request, "Supports specifying the directory to save in the SaveAs function”.

Best regards, Julie
  1. Helpful 2
  1. Miguel Leeuwe
  2. Wednesday, 8 September 2021 07:43 AM UTC
That's great Julie! Thanks.
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 7 September 2021 19:14 PM UTC
  2. PowerBuilder
  3. # 1

Using your example, the following opens the d ialog in the specified folder without restricting the file types.


string     ls_path, ls_file, ls_initialDir, ls_title
int     li_rc

ls_title         = "Save as ..."
ls_initialDir     = "c:\temp"
ls_path         = ls_initialDir

li_rc = GetFileSaveName ( ls_title, ls_path, ls_file )

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.