Hi Rex,
Yes about the 13th character (is that a movie title, or what?), I was
just giving the general approach.
As for path or not in table locations, you really can't assume that the
workspace path is the path of all non-full-path tables.
Especially if the table path is just a file name, and you've defined
mutiple table data roots in the Directory Setting in MIPro. The multiple
table data root feature in not well-known, but it allows you to specify
a number of directories under which tables are usually found. If MIPro
is set to open a path-less table, and the table isn't present in the
current working directory, it'll scan each table data root in turn for a
table with that name, and open it if it finds such a table.
Much like what the DOS environment variable PATH does for command line
execution.
And if that search fails, MIPro'll show a dialog box, in which the user
can choose to open any table anywhere.
I.e., you can't be 100% sure where the table is located until MIPro has
opened it.
If you want to verify multiple workspaces, I'd do it like this:
For all workspaces
1. Clear everything (close all tables, windows etc).
2. Open the workspace
3. Record opened table locations
Best regards / Med venlig hilsen
Lars Nielsen
GisPro
Rex Ballard wrote:
Hi Lars & Listers,
Your reply has me a little worried as I have been doing a similar thing to
report on and edit workspace files containing tables which have to be moved for
one reason or another (eg corporate restructuring).
Won't pos1 in your code always be equal to 12 in a LTrim'd string, making the
first character of the table to be opened the 13th character?
And if the full path is not given (ie the 15th character is not a colon), isn't
the path of the tale the same as the path of the workspace file?
I haven't noticed any corrupt workspaces yet, but then I haven't tried to open
all of them!
Cheers
Rex Ballard
GIS Officer
City of Rockingham
Civic Boulevard
Rockingham
Western Australia
PO Box 2142
Rockingham WA 6967
Direct Tel. 9528 0430
Email : [EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Lars V.
Nielsen (GisPro)
Sent: Friday, January 20, 2006 5:05 AM
To: Simon Allen
Cc: [email protected]
Subject: Re: [MI-L] Last Table
Hi Simon,
Many questions, I hope I caught them all.
If you want to obtain the (optional) path value between the quotes in an
Open Table statement in a workspace, this is quite easy
pos1 = InStr ( 1 , workspaceLine , """" ) 'note that the quote is
doubled inside the string to yield a single quote
pos2 = Instr ( pos1+1 , workspaceLine , """" )
path = Mid$ ( workspaceLine , pos1+1, pos2-pos1-1 ) 'provide both
pos1 and pos2 are positive
The complete path of the TAB file (i.e. the table path) can be queried
when the table is open in MIPro like this
path = TableInfo ( tableName , TAB_INFO_TABFILE )
The last table opened can be referenced by using a zero for table name :
tableName = TableInfo ( 0 , TAB_INFO_NAME )
Note that workspaces not necessarily contain full paths to tables, and
that the alternate location setup may cause tables to be opened from any
location. Only when MapInfo has opened the table, the full path can be
determined with absolute certainty.
HTH
Best regards / Med venlig hilsen
Lars Nielsen
GisPro
Simon Allen wrote:
Hi All
I have a database of MapInfo tables including paths. I also have a
database of all our workspaces. I have produced a script to count the
number of times each table is opened in these workspaces. This takes
each Open Table statement and loops through the tables database
searching for each value in the database against it i.e.
pos = InStr(1, LCase$(opentablestatement), mapinfotablename)
If pos > 0 Then
increment count
etc.
But I'm not happy. I've done it this way because I couldn't find a way
to extract the table path & name from an open table statement. MapInfo
doesn't, for instance, allow you to define custom delimiters (") and get
the String between. If I were able to I could query the tables database
for the for the table path & name. This would be very much quicker. (We
have a lot of tables and workspaces!). And my life would be improved no
end.
I also considered that I might Run each Open Table statement and then
obtain the table path and name from the last table opened and then use
this to search the database. Still can't do.
Can anyone help with this?
In anticipation, thank-you.
Simon Allen, Senior GIS Officer
[EMAIL PROTECTED]
South Gloucestershire Council
Council Offices
Castle Street
Thornbury
South Gloucestershire
BS35 1HF
phone: 01454 863655 (direct)
fax: 01454 863855
http://www.southglos.gov.uk
**********************************************************************
This email and any files transmitted with it from South
Gloucestershire Council are confidential and intended
solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error
please notify the South Gloucestershire Council
Postmaster at the address below.
This footnote also confirms that this email message has
been swept for the presence of computer viruses.
[EMAIL PROTECTED]
**********************************************************************
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l
This email may contain advice and comment on a matter which is currently being
considered by Council or may be considered by Council in the near future. Any
advice or comments are the views of the Officer sending this email and should
not be construed as a formal Council position. The information transmitted is
intended only for the person or entity to which it is addressed and may contain
confidential and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon, this
information by persons or entities other than the intended recipient is
prohibited. If you received this in error, please contact the sender and delete
the material from any computer.
This footnote also confirms that this email message has been swept by McAfee
for the presence of computer viruses.
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l