Page 1 of 1
name=OPEN:
Posted: Tue Dec 20, 2011 12:40 pm
by ranjsuri
All -
I am trying to use the "Name=Open:" (
http://brwiki.ads.net/index.php?title=Name%3DOpen:) syntax to mimic a file browser. It works, except from the verbiage on the wiki I cannot figure out how to make it "default" to a specific directory. I tried to give it a path after the "|" but that doesnt seem to work. Can I someone point me in the right direction on this subject?
Thanks
Ranjini
Posted: Tue Dec 20, 2011 1:53 pm
by gtisdale
34810 OPEN #(XPT:+FNGETHANDLE): "name=open:"&POST$&"\*.xpt",INTERNAL,OUTIN,RELATIVE ERROR 34820
34820 IF FILE(XPT)<0 THEN RETURN
FNGeorge
Posted: Tue Dec 20, 2011 1:55 pm
by gtisdale
Correction: The "+" was supposed to be "="
I fat fingered it.
FNGeorge
Posted: Tue Dec 20, 2011 3:58 pm
by John
85600 open #h_tmp:=fngethandle: "name=OPEN:ACS Company (*.acs"&cursys$&") |*.acs??,recl=1,shr",external,input ioerr OPEN_CANCELED
85800 print file$(h_tmp)
86000 close #h_tmp:
86200 OPEN_CANCELED: !
I believe this may demonstrate what you're wanting to do. Feel free to make the wiki more clear once you understand it. I believe I've given you editor rights already.
-John
Posted: Wed Dec 21, 2011 9:20 am
by gtisdale
In my experience the data on the OPEN line between the colon ":" and the bar "|" do nothing. Perhaps someone else has found that these appear somewhere or change the disply, but on my Vista machine running BR4.20g they seem to have no effect what so ever.
In addition, I find that sometimes having included this information will start my search in the wrong directory, whereas leaving this information out always puts me into the designated directory. I have not been able to determine what cuases the wrong directory search, I just leave that info out and get what I want.
FNGeorge
Posted: Tue Dec 27, 2011 7:40 am
by ranjsuri
Unfortunately this is still not working for me. Here is the code i trying..
Code: Select all
00020 DIM Post$*50
00030 LET Post$="@::text documents (*.ini)|C:\Windows\*.ini"
00040 OPEN #H_Tmp:=12: "name=OPEN:"&Post$&",recl=1,shr",EXTERNAL,INPUT
00050 IF File(Xpt)<0 THEN PAUSE
I would expect it to open "C:\Windows\*.ini" but it always opens the location in "memory" which is the previous file location a file was opened from via BR.
Could it be possible that what you are all seeing is the location in "memory" as well?
Thanks
Ranjini
Posted: Tue Dec 27, 2011 7:54 am
by gtisdale
Try
Code: Select all
00020 DIM Post$*50
00030 LET Post$="C:\Windows\*.ini"
00040 OPEN #H_Tmp:=12: "name=OPEN:"&Post$&",recl=1,shr",EXTERNAL,INPUT IOERR 50
00050 PAUSE
This should show the files in Windows. If you are using client server and want client side windows directory then add the @. If not using client server, or you are serching a BR mapped drive don't insert the @
If The named directory does not exist of BR can't find it then the open will default to the last "OPEN" location.
FNGeorge
Posted: Tue Dec 27, 2011 10:41 am
by ranjsuri
Thanks, that does work.. although, i could swear, I tried that before! Anyway!
Much appreciate your input and help
Posted: Tue Dec 27, 2011 3:00 pm
by GomezL
I have learned that the "@::" or "@:" when used with an "OPEN Statement" is always required in Client Server. (Regardless of the Mapping in the BRCONFIG).
Leaving it out generates an error 626.
I also found that when using "@::", the "Client Drive" will be used, not the "Server or Virtual Drive".
Code: Select all
00020 DIM Post$*50
00030 LET Post$="All Log Files | *.LOG"
00040 OPEN #H_Tmp:=12: "name=OPEN:@::"&Post$&",recl=1,shr",EXTERNAL,INPUT IOERR 50
00050 PAUSE
The above sample opens to the "Last Remembered Position", and displays "All Log Files" in the "File Type" combo box. It also displays "Only Log Files".
The problem seems to be that this syntax does not allow the user to define a "Hard Coded Path".
I have a feeling that "Long File Names" mucked with this feature so that the parsing doesn't work as expected any more!
Posted: Wed Dec 28, 2011 6:30 am
by GomezL
I think I finally wrapped my head around this command.
Code: Select all
00010 OPEN #1: "name=OPEN:C:\Windows\ Text Files (*.ini;*.txt)|*.ini;*.txt,recl=1,shr",EXTERNAL,INPUT IOERR 100
00020 PRINT File$(1)
00030 CLOSE #1:
00100 PRINT "Operation Canceled: Err=";Err
00200 XIT: !
The above example will display *.ini & *.txt files in the C:\Windows Folder.
In the "Filter Combo box", it will display Text Files (*.ini;*.txt)
I also added additional information to the wiki
http://brforum.ads.net/viewtopic.php?p=2565#2565[/code]