Author Topic: OpenFileDialog  (Read 15709 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: OpenFileDialog
« Reply #30 on: January 30, 2007, 11:21:36 AM »
Thanks hendie for the feed back.

I did consider that method but no easy way to get files from two different folders.
I could add a button to get another folder I suppose.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: OpenFileDialog
« Reply #31 on: January 30, 2007, 12:04:15 PM »
CAB you could smudge it by using the Browse for folders in your first post...
use the browse for folder to *ahem* browse for folders, then add a listbox to the form that displays all the files in the selected folder, and use that listbox to let the user select multiple files.
Thanks hendie for the feed back.

I did consider that method but no easy way to get files from two different folders.
I could add a button to get another folder I suppose.
That is how I do it with my plot dialog box.  I have a button to open the BrowseForFolder dialog, then I add all the drawings in said folder to a list box, then add the selected ones to a list, path and all.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

GDF

  • Water Moccasin
  • Posts: 2081
Re: OpenFileDialog
« Reply #32 on: January 30, 2007, 12:09:11 PM »
Hi
Try this
Code: [Select]
(defun FileBox(/ cdl f)
;OFN_READONLY &H1       1 La case 'Lecture seule' est cochée à la création de la fenêtre.
;OFN_OVERWRITEPROMPT &H2       2 Afficher un message de confirmation d'écrasement de fichier si celui-ci existe déjà.
;OFN_HIDEREADONLY &H4       4 Case à cocher 'Lecture seule' invisible.
;OFN_NOCHANGEDIR &H8       8 Conserve le répertoire d'origine à la fermeture de la fenêtre.
;OFN_SHOWHELP &H10      16 Afficher le bouton 'Aide' dans la boîte de dialogue.
;OFN_NOVALIDATE &H100     256 Ne vérifie pas la validité de la saisie (validité du nom de fichier).
;OFN_ALLOWMULTISELECT &H200     512 Autoriser la sélection multiple de fichiers.
;OFN_EXTENSIONDIFFERENT &H400    1024 Indique que l'utilisateur a choisi une extension différente de celle par défaut.
;OFN_PATHMUSTEXIST &H800    2048 Les chemins et fichiers saisis doivent exister.
;OFN_FILEMUSTEXIST &H1000    4096 Seuls des fichiers existants peuvent être saisis.
;OFN_CREATEPROMPT &H2000    8192 Afficher une fenêtre de confirmation de création de fichier.
;OFN_SHAREAWARE &H4000   16384 Ignorer les erreurs de partage réseau.
;OFN_NOREADONLYRETURN &H8000   32768 Ne sélectionne pas la case à cocher 'Lecture seule'.
;OFN_NOTESTFILECREATE &H10000   65536 Le fichier ne sera pas créé avant la fermeture de la fenêtre.
;OFN_NONETWORKBUTTON &H20000 131072 Cache (désactive) le bouton 'Réseau'.
;OFN_NOLONGNAMES &H40000 262144 Utilise les noms courts de fichier (sans effet dans le cas des fenêtres du type 'Explorer').

;OFN_EXPLORER &H80000 524288 Donne un style 'Explorer' à la boîte de dialogue (par défaut).
; Qui ne fonctionne apparement pas sous XP

;OFN_LONGNAMES &H200000 2097152 Gestion des noms longs pour les boîtes de dialogue n'ayant pas le style 'Explorer'.
;OFN_NODEREFERENCELINKS &H100000 1048576 La boîte de dialogue prendra le nom et le chemin du raccourci sélectionné.

  (setq cdl (vlax-create-object "userAccounts.CommonDialog"))
  (vlax-put-property cdl 'filter (vlax-make-variant "Fichiers dessins (*.dwg)| *.dwg |Fichiers DXF (*.dwf) |Tous les fichiers (*.*)|*.*"))
  (vlax-put-property cdl 'filterindex 1)
  (vlax-put-property cdl 'flags (+ 4 8 512 2048 4096 131072 2097152))
  (vlax-put-property cdl 'initialdir (getvar "dwgprefix"))
  (if (eq (vlax-invoke cdl 'showopen) -1)
    (setq f (vlax-get-property cdl 'filename))
    (setq f nil)
  )
  (vlax-release-object cdl)
  f
)

ps : sorry for the language. It's in french

@+


<edit: Fixed Code tags>


Works for me here. Using windows xp and autocad 2007....but the  dialog box is in french.

Gary
« Last Edit: January 30, 2007, 12:11:21 PM by Gary Fowler »
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

T.Willey

  • Needs a day job
  • Posts: 5251
Re: OpenFileDialog
« Reply #33 on: January 30, 2007, 12:48:23 PM »
I was searching on the MSDN site and found this question.
Quote
Hey, Scripting Guy! Is there any way I can use a script to present a user with a dialog box and let him or her select a file?

-- BF
And this answer
Quote
Hey, BF. If you’re using Windows 2000, we don’t know of a way to do this, at least not a way that’s built into the operating system. That’s not the case with Windows XP, however. On Windows XP, you can use the UserAccounts.CommonDialog object to present users with a standard File Open dialog box. Here’s what the script looks like:
Here

It doesn't look good for use Win2000 people Alan.  I will continue to look when I have free time.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: OpenFileDialog
« Reply #34 on: January 30, 2007, 12:51:01 PM »
Oh well, at least I'll quit head butting that wall. :-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

whdjr

  • Guest
Re: OpenFileDialog
« Reply #35 on: January 30, 2007, 01:52:14 PM »
I was searching on the MSDN site and found this question.
Quote
Hey, Scripting Guy! Is there any way I can use a script to present a user with a dialog box and let him or her select a file?

-- BF
And this answer
Quote
Hey, BF. If you’re using Windows 2000, we don’t know of a way to do this, at least not a way that’s built into the operating system. That’s not the case with Windows XP, however. On Windows XP, you can use the UserAccounts.CommonDialog object to present users with a standard File Open dialog box. Here’s what the script looks like:
Here

It doesn't look good for use Win2000 people Alan.  I will continue to look when I have free time.
Once again this doesn't Alan, but Tim's previous post was for a single selection Dialog box, HERE is for a multi-select Dialog Box.

Sorry Alan  :-(

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: OpenFileDialog
« Reply #36 on: January 30, 2007, 02:03:46 PM »
 . . . good ole ObjectDCL . . .  :lol:
James Buzbee
Windows 8

T.Willey

  • Needs a day job
  • Posts: 5251
Re: OpenFileDialog
« Reply #37 on: January 30, 2007, 02:05:48 PM »
. . . good ole ObjectDCL . . .  :lol:
Does ObjectDCL has the same limit as regural dcl?  Limited by the amout of items you can select, I think it's around 255 (Acads magic number).
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CADmium

  • Newt
  • Posts: 33
Re: OpenFileDialog
« Reply #38 on: August 26, 2009, 03:17:38 AM »
Is there a flag for the UserAccounts.CommonDialog-Object to get a Filesaveas-dialog ?
"Bei 99% aller Probleme ist die umfassende Beschreibung des Problems bereits mehr als die Hälfte der Lösung desselben."

CADmium

  • Newt
  • Posts: 33
Re: OpenFileDialog
« Reply #39 on: August 26, 2009, 03:38:21 AM »
ok .. found it ... look at the Object "SAFRCFileDlg.FileSave"
"Bei 99% aller Probleme ist die umfassende Beschreibung des Problems bereits mehr als die Hälfte der Lösung desselben."