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
 rename active window
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

kfauth

Germany
33 Posts

Posted - 06/27/2016 :  11:36:42 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Pro 2015G Sr2
Operating System:Win7Pro

Dear all,

somehow I am overlooking the obvious, I think. I have to process hundreds of ASCII files and would very much like to have this automatted.

The file names are long, though, and upon loading one into the active window (a worksheet, using 'open -w filename' ) the window name changes (to the filename, in principle), but it is being truncated.

So I would like to
a) immediately rename the still active window (but I find no command for this)
b) not have the window name changed in the first place.

Is this possible from a simple Labtalk script activated through klicking a button (text box)?

Edited by - kfauth on 06/28/2016 03:24:32 AM

Chris D

428 Posts

Posted - 06/27/2016 :  12:28:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can have more control over importing text files including book and sheet naming (or not renaming) by using the impASC X-function. It even offers the ability to run a script right after every import.

It requires a bit more work to code than using the open command but it may be worth the effort.

Here is a quick overview: http://www.originlab.com/doc/LabTalk/guide/Importing-Data

And here are the docs for the X-Function and its options:
http://www.originlab.com/doc/X-Function/ref/impASC
http://www.originlab.com/doc/X-Function/ref/Details-of-TreeNodes-in-Import-ASCII


Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

kfauth

Germany
33 Posts

Posted - 06/28/2016 :  01:22:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Chris.

I have been through these before. I am surprised that there are no more comprehensive docs. The examples mention the possibilities
options.ImpMode:=3 and options.ImpMode:=4 but I am missing a comprehensive table of all values (what about 0..2 ?) and the detailed description of what happens.

Another example sais impasc has many options adn I'd like to see a kind of doc or manpage(s) where all options are systematically listed and their implications indicated.

I was unable to figure out how to avoid the renaming of the window that is being imported into. I tried
options.Names.AutoNames:=0 but to no avail (again, I find no document which exactly sais what kind of auto-naming is concerned. That leads me to try-and-error kind of coding sessions more often than not and I don't consider this as time well-spent...)

OK , while ging back and forth to write this, I saw that I previously overlooked options.Names.FNameToBk:=0. That's what I'll try next.

Edited by - kfauth on 06/28/2016 03:24:57 AM
Go to Top of Page

kfauth

Germany
33 Posts

Posted - 06/28/2016 :  03:29:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
options.Names.FNameToBk:=0 indeed does the job.
Go to Top of Page

nico_h

Germany
3 Posts

Posted - 01/09/2018 :  06:27:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I'd also be interested in a way to rename the active worksheet without having to input the current name.
That is hardly possible, when automatically processing many files.
Go to Top of Page

Castiel

343 Posts

Posted - 01/09/2018 :  9:00:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by nico_h

I'd also be interested in a way to rename the active worksheet without having to input the current name.
That is hardly possible, when automatically processing many files.



The wks object refers to the active sheet (worksheet or matrix sheet) if no range is specified. To rename the active sheet using LabTalk, simply:
wks.name$="New Name"



     #####
    #### _\_  ________
    ##=-[.].]| \      
    #(    _\ |  |------|
     #   __| |  ||||||||
      \  _/  |  ||||||||
   .--'--'-. |  | ____ |
  / __      `|__|[o__o]|
_(____nm_______ /____\____ 
Go to Top of Page

nico_h

Germany
3 Posts

Posted - 01/10/2018 :  03:35:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sorry, I made a mistake in my post.
What I actually ment was "rename the active workBOOK".
This is not possible in a similar way as renaming the active worksheet, because you have to input the current name. (Dont you?)

The way I accomplished it is:
win -r %(page.name$) newname
It works fine for me this way.
Go to Top of Page

Castiel

343 Posts

Posted - 01/10/2018 :  04:55:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by nico_h

Sorry, I made a mistake in my post.
What I actually ment was "rename the active workBOOK".
This is not possible in a similar way as renaming the active worksheet, because you have to input the current name. (Dont you?)

The way I accomplished it is:
win -r %(page.name$) newname
It works fine for me this way.




You are right about it. That page.name$ is read-only is quite weird.
If not comfortable with %(page.name$), have a try of %H
win -r %H newname

%H is the name of the active window.


     #####
    #### _\_  ________
    ##=-[.].]| \      
    #(    _\ |  |------|
     #   __| |  ||||||||
      \  _/  |  ||||||||
   .--'--'-. |  | ____ |
  / __      `|__|[o__o]|
_(____nm_______ /____\____ 
Go to Top of Page

nico_h

Germany
3 Posts

Posted - 01/10/2018 :  06:55:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
What makes you not comfortable with %(page.name$)?
For me booth versions work so I can't figure out the difference.

page.name$ = short name
%H = window title (=short name!?)

Edit: Just noticed that you wrote "If not comfortable". I read "I'm not ...".
So don't mind the question.

Edited by - nico_h on 01/15/2018 02:44:05 AM
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 01/10/2018 :  1:59:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Yes, %H and page.name$ are the same thing, just %H is easier to use.

They are both read only.


CP
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