How to hide files with Autolisp

How to hide files with Autolisp

Anonymous
Not applicable
1,133 Views
5 Replies
Message 1 of 6

How to hide files with Autolisp

Anonymous
Not applicable

I used Autolisp to export block attributes to text files.

And I want to hide these files when creating them with Autolisp.

I can't find related code.

Any information is grateful.

Thanks.

 

Canaan.

0 Likes
1,134 Views
5 Replies
Replies (5)
Message 2 of 6

roland.r71
Collaborator
Collaborator

You can use DOSlib for that.

 

(dos_attrib [filespec [bits]])

 

filespec

The desired file or files. filespec can contain wildcard characters ("*" and "?"). If filespec is not supplied, it is assumed to be *.*.

 

bits

A bit-coded integer identifying the desired file attributes to set. Specify more than one file attribute by adding the following bit values:

0 (bit 0) Normal

1 (bit 1) Read-Only

2 (bit 2) Hidden

4 (bit 3) System

8 (bit 4) Archive

 

I'm not aware of any other way

0 Likes
Message 3 of 6

vladimir_michl
Advisor
Advisor

You don't need dos_lib for this. Just use the following function (don't forget to double backslashes in the file path):

(defun hidefile (fname / filobj fsobj)
 (setq filobj (vlax-invoke (setq fsobj (vlax-get-or-create-object "scripting.filesystemobject"))
                           'getfile
                           fname))
 (vlax-put filobj 'attributes (logior 2 (vlax-get filobj 'attributes)))
 (vlax-release-object filobj)
 (vlax-release-object fsobj)
 (princ)

 

Vladimir Michl, www.cadstudio.cz - www.cadforum.cz

 

Message 4 of 6

dgorsman
Consultant
Consultant

Hiding files is generally a no-no in software design.  It makes clean up and management difficult and can lead to other problems.  Please google 'Sony DRM rootkit' before proceeding.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 5 of 6

roland.r71
Collaborator
Collaborator

@dgorsman wrote:

Hiding files is generally a no-no in software design.  It makes clean up and management difficult and can lead to other problems.  Please google 'Sony DRM rootkit' before proceeding.


Although I almost didn't answer the question, from a ethical point of view (I can't think of any normal reason to hide a file with extracted attribute values, sounds fishy to me),

 

You however are taking it way over the top. I realy don't see how hiding a tekst file has ANYTHING to do with the stuff Sony pulled. If you do, would you please contact Microsoft about "AppData" and a ton of other hidden files & folders?

0 Likes
Message 6 of 6

pbejse
Mentor
Mentor

@Anonymous wrote:

I used Autolisp to export block attributes to text files.

And I want to hide these files when creating them with Autolisp.


I'm going to ask the  same question as the others. Why hide it? 

Hiding the files means "no one else should be able to see" the files?  But still accessible only to your program?  

 

If a program is not prompting the user as to where the data would be exported, the program  can very well save the data to any folder and no one would know. No point of changing its file attributes to hidden or what not.

 

Can you clear this up for us if you dont mind @Anonymous 

 

 

0 Likes