TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: snddd2000 on January 27, 2013, 10:23:22 PM

Title: A strange about function "getfiled"
Post by: snddd2000 on January 27, 2013, 10:23:22 PM
here a confused
At home computer ,I run (setq csvfile (getfiled  "" "" "csv" 4))
if i directly point a file,the return is right, for example "C:\\Users\\new.csv"
if I open a folder "1" under folder "Users"  then back folder "Users" point "new.csv" .
The return will be "C:\\Users\\1\\new.csv"
Office computer, everything is Ok.
Someone know why, and solve
thanks
Title: Re: A strange about function "getfiled"
Post by: Keith™ on January 27, 2013, 10:59:32 PM
the file name returned should be the file selected. If you have the same file name in both folders, the function will not automatically select the one in the current folder. using your example, if you select a file "new.csv" in folder "C:\Users\1\", then change folders to "C:\Users\" If you don't select the file "new.csv" in that folder, the location will be C:\Users\1\
Title: Re: A strange about function "getfiled"
Post by: snddd2000 on January 28, 2013, 02:52:12 AM
thanks keith
but  folder "1" is empty.
Title: Re: A strange about function "getfiled"
Post by: Keith™ on January 28, 2013, 08:20:32 AM
Have you tried setting flags to 8 or 12? Using 4 is to allow an arbitrary file extension.
Title: Re: A strange about function "getfiled"
Post by: Lee Mac on January 28, 2013, 08:45:15 AM
Do you receive the same behaviour when testing with:

Code: [Select]
(getfiled "" "" "csv" 0)
Title: Re: A strange about function "getfiled"
Post by: snddd2000 on January 28, 2013, 06:21:23 PM
Yes , receive the same behaviour when testing with 0 4 8 12 128.
I have no idea. :roll:
thanks all
Title: Re: A strange about function "getfiled"
Post by: snddd2000 on January 28, 2013, 08:10:50 PM
This morning, I think again, what is the different between my computer at home and office.
Home's is single-click to open an item;
Office's is the standard double-click.
So I change office's computer to single-click in Folder Options.
Then run above code again.
So the return is same as at home, get a wrong full-name.
Have any solution about this?
Title: Re: A strange about function "getfiled"
Post by: Lee Mac on January 28, 2013, 08:16:39 PM
Have any solution about this?

Change both to double-click? :P
Title: Re: A strange about function "getfiled"
Post by: snddd2000 on January 28, 2013, 11:56:16 PM
 Maybe it is the only way? 8-)
Title: Re: A strange about function "getfiled"
Post by: CAB on January 28, 2013, 11:57:41 PM
Maybe an alternate method.
http://www.theswamp.org/index.php?topic=14715.msg177776#msg177776
http://www.theswamp.org/index.php?topic=14715.msg177779#msg177779
Title: Re: A strange about function "getfiled"
Post by: xiaxiang on January 29, 2013, 03:07:44 AM
Another way
http://www.theswamp.org/index.php?topic=12730.msg423067#msg423067
Title: Re: A strange about function "getfiled"
Post by: snddd2000 on January 29, 2013, 03:40:19 AM
Thanks Cab and Xia
Yes, I like "MSComDlg.CommonDialog".
but GetInterfaceObject maybe better?