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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Issue combining strings with /
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Clairekun

Germany
175 Posts

Posted - 06/16/2022 :  7:46:36 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Windows 10

Hello,

I am trying to define a series of strings extracted from graph names, in order to move those graphs to their corresponding folders.

An example of a graph name is: gdH1p5z650C

I want to check for the left and right parts of the name; one will define the parent folder, and the other will define the child folder to move to.

string gName$ = page.name$;
string FvarDSC$="ZnO-Temp-Var DSC";
string gFol1$; 
string gFol2$;
string gFol$="/%(gFol1$)/%(gFol2$)"; //Parent/child folder path

if (Left(gname$,3)$ == "gdH") 	gFol1$ = "DSC";
if (Right(gName$,1)$ == "C")	gFol2$=%(FvarDSC$);

I tried to use pe_move command, but an error popped up stating that the graph couldn't be moved to "//". Apparently, it is not reading the strings correctly for gFol$.

The results I obtained in my test is:

gFol1$=; 
gFol2$=;
gFol$=;

DSC
ZnO-Temp-Var DSC
//

However, this changes the active folder correctly:

//From any folder
pe_cd path:=gFol$;

I have used
pe_move path="/%(string$)"
successfully in previous ocassions.


What am I doing wrong? Thank you.

YimingChen

1593 Posts

Posted - 06/17/2022 :  08:45:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Do you need to move the line string gFol$="/%(gFol1$)/%(gFol2$)"; to the end after gFol1$ and gFol2$ are assigned?

James
Go to Top of Page

Clairekun

Germany
175 Posts

Posted - 06/17/2022 :  7:06:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I moved it right before defining gFol1$ and gFol2$, and it worked. Thanks for the advice, that solution would nave never even crossed my mind.

Why, though? I would think that it's necessary to define all components contained in a string such as gFol$ beforehand.

EDIT: Encountered another error when applying the command pe_move.

While the strings alone seemed to work if gFol$ was placed before the others, pe_move generated the error: Undefined Variable gFol1$, so I assumed gFol1$ and gFol2$ would still need to be defined before gFol$.

What I did was define string gFol$ right before pe_move; that is, after gFol1$, gFol2$ and all conditions.

This is what finally worked.

Edited by - Clairekun on 06/18/2022 11:23:49 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000