The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 xfunction dlgfile and space character in path

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
hgibhar Posted - 11/23/2012 : 09:09:25 AM
Origin Ver. 8.6 and Service Release 3
Operating System: win7 prof 32bit

Hello,

my fdlog problem remains to exist. However, I changed to the x-function dlgFile. There is a problem with white spaces in the directory name. I have a file in a directory (which contains a space):

d:\holger\gamma_origin\teste leerzeichen\g0016835.dat

I want to make some work with this file.

My test script is:

//x-function for multiopen
dlgFile title:="Open Gamma Files" group:="*.dat" multi:=1 init:="d:\holger\gamma_origin\teste leerzeichen";

string files$ = fname$; //save result file name list
int count=files.GetNumTokens(CRLF);
type files$;
type fname$;
count=;


The response of the x-function is:

D:\holger\gamma_origin este leerzeichen\g0016835.dat

Hence, the result string skipped the character \t an origin is not able to open this file! This seems to me to be a severe problem, because the number of files is determined by the GetNumTokens function (see example).

So, what to do now???

Thanks for any hint.

Holger
4   L A T E S T    R E P L I E S    (Newest First)
hgibhar Posted - 11/26/2012 : 10:35:50 AM
Dear CP,

thank you very much for your reply. I knew the verbose parameter -v, but as I thought about your reply and the line "GetNumToken(CRLF)", I found my mistake:

It seems to me, that the filenames of dlgFile (as multiopen dialog) are separated by CRLF. Hence, the loop over all tokens must be done with CRLF:

nn$=fname.GetToken(ii,CRLF)$;

This, I did not thought of. If nothing is given as separator, any white character is used as separator, and this breaks the (path-)filenames to wrong tokens.

Now, it works

Holger
cpyang Posted - 11/24/2012 : 05:42:04 AM
The type command will interpret \t as TAB by default. To preven this, use type -v text instead. I tried with a path like you had with the following and the result is correct:


dlgfile group:="*.dat" multi:=1;
type -v fname$;
string files$ = fname$;
int count=files.GetNumTokens(CRLF);
count=;


CP
hgibhar Posted - 11/23/2012 : 10:54:53 AM
I extendend for tests the script:

[test]
//x-function for multiopen
dlgFile title:="Open Gamma Files" group:="*.dat" multi:=1 init:="d:\holger\gamma_origin\teste leerzeichen";

string files$ = fname$; //save result file name list
int count=files.GetNumTokens(CRLF);
//Choose only one file, hence count = 1
count=;

int index=0;
string testtoken$;

//look how much tokens there
for(index=1;index <= 2; index++)
{
testtoken$=fname.GetToken(index)$;
type testtoken$;
}

//compare with % variable
%M=fname$;
%M=;
for(index=1;index <= 4; index++)
{
type %[%M,#index];
}


See the results:

count=1
D:\holger\gamma_origin este
leerzeichen\g0016834.dat
D:\holger\gamma_origin\teste leerzeichen\g0016834.dat
D:\holger\gamma_origin este
leerzeichen\g0016834.dat

Only one file was choosen; nevertheless there are 2 tokens as result of dlgfile and the first token lost \t.
The printout of %M yields the correct path, but the tokens are wrong, too.

Thanks for help.

Holger
hgibhar Posted - 11/23/2012 : 10:36:57 AM
Here is a new aspect: if I put the result of dlgfile into a %variable,
the two characters are sustained:

%M=fname$;
%M=;

The result is:
D:\holger\gamma_origin\teste leerzeichen\g0016836.dat

It is unclear to me.

Holger

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000