the_dude_abides
Member
Hi.
I am trying to make a function that will loop through any scripts in a project, and read them as a text file into a data structure. The intent is to be able to edit the data structure content: remove unused variables / duplicated variables / correct errors and so forth, and then write the edited text file back into the script directory (or at least be saved, and then can be manually replaced)
I've figured out how to loop through the script resources (this is while running the project) and create ds_lists that have newly created variables with extended names taken from the script names. Then at the end it deletes all of these structures. The process for this seems to be fine.
The problem comes from whether it is possible to set up the file handling to automatically allow the user to read the scripts, once the directory is pointed to manually. Using "get_open_filename" gives the means to locate the files source, but I want to make this automated afterwards for multiple files from the script location, and can't figure out how to do that.
Assuming that the issue isn't getting the file path etc, but that the issue is that access is only given each time "get_open_filename" is used (which I can see how I might be able to do that repeatedly, but it could prove tedious to use if there's lots of scripts to edit)
Is there a way to get the location of where the scripts are, and repeatedly access it for different files, without having to just keep calling "get_open_filename"?
OR
Do any of the directories temp / working / program have the scripts stored in them? I tried all three without success, but maybe wasn't calling them correctly. Finding the scripts location manually isn't a problem, yet using the path it gives seems to fall foul of the sandboxing. So is there one of the accessible directories that has the scripts in it?
Thanks for any help with this
I am trying to make a function that will loop through any scripts in a project, and read them as a text file into a data structure. The intent is to be able to edit the data structure content: remove unused variables / duplicated variables / correct errors and so forth, and then write the edited text file back into the script directory (or at least be saved, and then can be manually replaced)
I've figured out how to loop through the script resources (this is while running the project) and create ds_lists that have newly created variables with extended names taken from the script names. Then at the end it deletes all of these structures. The process for this seems to be fine.
The problem comes from whether it is possible to set up the file handling to automatically allow the user to read the scripts, once the directory is pointed to manually. Using "get_open_filename" gives the means to locate the files source, but I want to make this automated afterwards for multiple files from the script location, and can't figure out how to do that.
Assuming that the issue isn't getting the file path etc, but that the issue is that access is only given each time "get_open_filename" is used (which I can see how I might be able to do that repeatedly, but it could prove tedious to use if there's lots of scripts to edit)
Is there a way to get the location of where the scripts are, and repeatedly access it for different files, without having to just keep calling "get_open_filename"?
OR
Do any of the directories temp / working / program have the scripts stored in them? I tried all three without success, but maybe wasn't calling them correctly. Finding the scripts location manually isn't a problem, yet using the path it gives seems to fall foul of the sandboxing. So is there one of the accessible directories that has the scripts in it?
Thanks for any help with this