Get full file and path name

139 views
Skip to first unread message

Sitaneph

unread,
Nov 6, 2007, 1:41:33 AM11/6/07
to MapInfo-L
I want to put the full file and path on a layout in a workspace (eg C:
\Project\mapping\general.wor) and i can't figure out how to get the
full path and file name in MapBasic.

Does anyone know what the code is as the help file is not very usefull

Tony Pilkington

unread,
Nov 6, 2007, 4:04:07 AM11/6/07
to mapi...@googlegroups.com
LAYER_INFO_PATH is the best way

Driver, Greg 9434

unread,
Nov 6, 2007, 5:53:33 AM11/6/07
to mapi...@googlegroups.com
If you want the workspace path/name rather than a tabfile path/name then
it's a bit more difficult. The following code was posted to the list
(by Dale Atkinson) and it reads the 'most recently used' list (File ->
Recent Files ) to find the last opened workspace:

dim i,s,z as integer
dim name, name1 as string

for i = 1 to 500
if MenuitemInfoByHandler(i,MENUITEM_INFO_HELPMSG) =
"Open this file." then
name =
MenuitemInfoByHandler(i,MENUITEM_INFO_TEXT)
s=instr(1,name,".WOR")
s=instr(1,name,".TAB")
z=instr(1,name,".tab")
z=instr(1,name,".wor")
if s <> 0 then

name1=MenuitemInfoByHandler(i,MENUITEM_INFO_TEXT)
name1=mid$(name1,4,100)
Print "workspace name = " + name1
exit sub
end if
if z <> 0 then

name1=MenuitemInfoByHandler(i,MENUITEM_INFO_TEXT)
name1=mid$(name1,4,100)
Print "workspace name = " + name1
exit sub
end if

end if
next


HTH

Greg Driver

System Administrator
Applications Support
ICT
NOT PROTECTIVELY MARKED

Reply all
Reply to author
Forward
0 new messages