MarkMc Posted December 22, 2018 Share Posted December 22, 2018 Working on this cabinet price thing again. Yesterday I set up to read a text file and got that to work. Opened plan this morning and get evaluation errors. Which I don't' understand. Checked with Dir.pwd and to find that Ruby is using the windows/system32 directory. Since I'm going to be giving this off to some others I don't want to use that. I found that to change directory I have to change the Safe level to 1. Wondering if that is seriously risky to give to others? I first tested a macro that simply changed the directory-once I did that the File.read macro worked. (I'm guessing that since the change directory executed) Does that create other problems that I don't know about? I'm thinking of setting up a directory "C:\Users\CA" to place the files. At least on Windows that is the simplest for me to hand off to others to create themselves and write into the macro? Don't know about on a Mac? I'm assuming that I need to write in some form of escape for this, yes? Link to comment Share on other sites More sharing options...
Alaskan_Son Posted December 22, 2018 Share Posted December 22, 2018 It sounds like you may be over complicating things. There should be no reason to change any directory. Not sure what exactly you’re doing, but I can get Ruby to read any relevant file on my system with the safe level turned up to max. Link to comment Share on other sites More sharing options...
MarkMc Posted December 22, 2018 Author Share Posted December 22, 2018 41 minutes ago, Alaskan_Son said: It sounds like you may be over complicating things. There should be no reason to change any directory. Not sure what exactly you’re doing, but I can get Ruby to read any relevant file on my system with the safe level turned up to max. I don't understand it. This worked fine last night, shut down computer, turned it on and get this. The only way I could get it back was to change directory which required changing safety level. Link to comment Share on other sites More sharing options...
Alaskan_Son Posted December 23, 2018 Share Posted December 23, 2018 4 hours ago, MarkMc said: I don't understand it. This worked fine last night, shut down computer, turned it on and get this. The only way I could get it back was to change directory which required changing safety level. You have to give Ruby the entire file path. Link to comment Share on other sites More sharing options...
MarkMc Posted December 23, 2018 Author Share Posted December 23, 2018 58 minutes ago, Alaskan_Son said: You have to give Ruby the entire file path. Well sort of- a copy of the path with standard backslashes "C:\Users\Mark\Documents\Chief Architect Premier X10 Data\Scripts\mod_test.txt" produces an error OTOH, reversing the slashes works , with or without the drive specified if it is on C ("/Users/Mark/Documents/Chief Architect Premier X10 Data/Scripts/mod_test.txt") -on another drive need all but still have to reverse the slashes. I don't understand what happened when I had several of these working last night-pcan only guess pilot error of some sort....pretty sure I saved before closing, maybe I didn't, maybe I changed the directory while messing around and the simpler form worked-maybe it was late. I'd prefer the short form which I've seen listed in lots of places just don't know how I got it working yesterday. Thanks though... Still have those original questions about safety if you or anyone would care to comment. Link to comment Share on other sites More sharing options...
Joe_Carrick Posted December 23, 2018 Share Posted December 23, 2018 I always have Ruby set to Safe Level 1. I don't think it's necessary for reading files - but it definitely is for writing files or creating directories. I've been doing this for years without any problems. It could be a problem if you get a macro from someone else who is unscrupulous but otherwise you can even set the Safe Level to "0" Link to comment Share on other sites More sharing options...
Alaskan_Son Posted December 31, 2018 Share Posted December 31, 2018 On 12/22/2018 at 5:53 PM, Joe_Carrick said: It could be a problem if you get a macro from someone else who is unscrupulous ...or just careless. Particularly if those macros are writing or overwriting files. Link to comment Share on other sites More sharing options...
Joe_Carrick Posted January 1, 2019 Share Posted January 1, 2019 8 hours ago, Alaskan_Son said: ...or just careless. Particularly if those macros are writing or overwriting files. True. I in fact use the ability to write and even over-write files and folders to accomplish certain tasks. Since I know what I'm doing and I am not malicious it's actually beneficial - but it would be fairly easy to create a macro that could erase files and even entire directories. That's why CA set the default to level 2 but it is in fact a handcuff. 1 Link to comment Share on other sites More sharing options...
DRAWZILLA Posted January 1, 2019 Share Posted January 1, 2019 I have been using Joe's macro's for many years now without any problems what -so-ever. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now