T O P I C R E V I E W |
kfauth |
Posted - 06/27/2016 : 11:36:42 AM 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)? |
9 L A T E S T R E P L I E S (Newest First) |
cpyang |
Posted - 01/10/2018 : 1:59:10 PM Yes, %H and page.name$ are the same thing, just %H is easier to use.
They are both read only.
CP
|
nico_h |
Posted - 01/10/2018 : 06:55:31 AM 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.  |
Castiel |
Posted - 01/10/2018 : 04:55:31 AM 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_______ /____\____
|
nico_h |
Posted - 01/10/2018 : 03:35:47 AM 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.
|
Castiel |
Posted - 01/09/2018 : 9:00:41 PM 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_______ /____\____
|
nico_h |
Posted - 01/09/2018 : 06:27:20 AM 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. |
kfauth |
Posted - 06/28/2016 : 03:29:12 AM options.Names.FNameToBk:=0 indeed does the job. |
kfauth |
Posted - 06/28/2016 : 01:22:35 AM 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. |
Chris D |
Posted - 06/27/2016 : 12:28:34 PM 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
|