Skip to main content
Known Participant
October 27, 2019
Question

Сan I change the path of a folder in a script without getting into the code

  • October 27, 2019
  • 2 replies
  • 802 views

Good afternoon, how can I change the path of a folder in a script without getting into the code?
For example: I run the script without an open document, I specify the path to the folder there, the script saves and remembers this path. When you run the script with an open document, the script does not ask for the path, but reads the one saved earlier.

This topic has been closed for replies.

2 replies

Kukurykus
Legend
October 27, 2019

At beginning of script put variable for empty path. Then the next part of script is going to check if the document is open. If it not nothing happens. If it is, the script is going to overwrite the first line where is set the variable for the path.

Known Participant
October 27, 2019

I'm completely new to this. Where can I see an example?
for example, the code for opening a file, how can variations be connected to it?

var desc1 = new ActionDescriptor();
desc1.putBoolean( stringIDToTypeID( "dontRecord" ), false );
desc1.putBoolean( stringIDToTypeID( "forceNotify" ), true );
desc1.putPath( charIDToTypeID( "null" ), new File( "E:\Pesikot.psd" ) );
desc1.putInteger( charIDToTypeID( "DocI" ), 397 );
executeAction( charIDToTypeID( "Opn " ), desc1, DialogModes.NO );
Mylenium
Legend
October 27, 2019

You would still need to make provision for a dialog in the script itself and then store the path in a text file or whatever, so I'm not really sure what you are looking for. A workaround might be to handle all file I/O operations by including an action, but that in itself has some not so minor limitations, so it may not be useful for whatever you have in mind.

 

Mylenium

Known Participant
October 27, 2019

I thought about the option of saving to a text document, but I do not know how to implement this.