• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

file esistente

  • Thread starter Thread starter lucasugar
  • Start date Start date

lucasugar

Guest
Hello everyone,
Is there a function to know if a file exists? I know the directory_exists function for directories. but for files?
 
I speak of onespace drafting (me10). between the various commands that the program provides, there is the directory_exists function that returns 1 or 0 depending on whether a given directory exists or not. would be convenient if there was a similar function to know if a given file exists or not. I didn't find anything I could do in my case, but I know there are commands for some reason not documented.
 
Hello everyone,
Is there a function to know if a file exists? I know the directory_exists function for directories. but for files?
ciao, in questo link
http://me10macro.awardspace.com/tipstricks.html#filebrowserthere is a macro to know which files exist in the current directory. If you know what files exist, you're halfway through the work.

It is about questioning these two tables:

logical table "fbt_dtab" for directory name

logical table "fbt_ftab" for content files (name, extension, size)

Perhaps it is a useful starting point.
 
Last edited by a moderator:
ciao, in questo link
http://me10macro.awardspace.com/tipstricks.html#filebrowserthere is a macro to know which files exist in the current directory. If you know what files exist, you're halfway through the work.

It is about questioning these two tables:

logical table "fbt_dtab" for directory name

logical table "fbt_ftab" for content files (name, extension, size)

Perhaps it is a useful starting point.
Here too should be interesting material:
http://www.clausbrod.de/cgi-bin/view.pl/cocreatemodeling/webhome
 
Hello everyone,
Is there a function to know if a file exists? I know the directory_exists function for directories. but for files?
looking for the solution to my problems I found on the internet the solution to yours.
the solution is simple and elegant:

let test_file_name'c:\my_file.txt
trap_error
open_infile 1 test_file_name end
if (check_error) {file does not exist}
open_outfile 1 test_file_name
command.. .
else {file exists}
close_file 1
command.. .


found on:
http://www.cocreateusers.org/forum/showthread.php?t=5443
 
ciao, in questo link
http://me10macro.awardspace.com/tipstricks.html#filebrowserthere is a macro to know which files exist in the current directory. If you know what files exist, you're halfway through the work.

It is about questioning these two tables:

logical table "fbt_dtab" for directory name

logical table "fbt_ftab" for content files (name, extension, size)

Perhaps it is a useful starting point.
In fact, this is a kind of solution I thought about. I'll take this into account.
Thank you.
 
looking for the solution to my problems I found on the internet the solution to yours.
the solution is simple and elegant:

let test_file_name'c:\my_file.txt
trap_error
open_infile 1 test_file_name end
if (check_error) {file does not exist}
open_outfile 1 test_file_name
command.. .
else {file exists}
close_file 1
command.. .


found on:
http://www.cocreateusers.org/forum/showthread.php?t=5443
This is also a solution I thought about. what I do not like about this approach is that the open_infile function uses file identification numbers (in this case 1) that can go from 0 to 10. if, unfortunately, the file identification number is already used by another macro at the same time, conflict problems arise.

I thought of a similar but better solution using copy_file function:

define file_exists

parameter

trap_error
copy_file
end
if (check_error)
le macro_result false

le macro_result true


end

by launching this macro with a file name as a parameter, the macro_result variable will contain false (0) or true (1) if the file exists.

Thanks to everyone anyway.

Hi. .
 
Good. .

I see there are people still fighting with me10 macros.

However at the end I ended up fighting: I managed to write the macro I wanted. scans parts list and automatically aggregates all parts with a same name.

so if I have a machine studio where you use a single part for each view it is all reunited.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top