Copy link to clipboard
Copied
Hello,
I have a script made for InDesign called "MultiPageImporter2.5"
It enables importing a full PDF file into InDesign.
My problem with it is,
that everytime I run it, it doesnt remember the folder I used last.
I.e., If I was in folder1>Folder2>Folder3,
it will constantly open up to folder1, and not to folder3 which was the last chosen file was found.
I am familiar with scripting, so I would like to try to change this,
However, I opened the script and I couldnt find any place for such a setting.
The script runs the opendialog() function, which automaticall opens to that directory.
Does anyone know what can be done for this?
Thanks!
Davey
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks -hans-
However, I dont understand what you are hinting to with that discussion
Copy link to clipboard
Copied
hi,
if you want to store data (folderpath), the discussion shows ways to do so.
Additional approach could be to write and read data to / from a file ...
Hans-Gerd Claßen
Copy link to clipboard
Copied
Thanks Hans!
Last night I managed to do it by writing it into a preference file.
However, that is not the best option, since this info shouldnt necessarily be saved from day to day...
So the information you pointed me to was great - worked great.
Here is what I did:
As I mentioned in my first post, the script uses the openDialog function.
Seemingly, that function opens a dialog to the last PARENT folder only, but not to the inner folder which was last used.
So what was needed was, to get the last used folder name and path,
and to then use the opendlg function with that information.
I.e.
var theFile = File.openDialog() ; // retrieves the file name chosen by the user
app.insertLabel("Open_Dlg_Dir", theFile) ; // inserts the file info into the application label under the name "Open_Dlg_Dir"
The next time around, the script checks for that info:
theFile = app.extractLabel("Open_Dlg_Dir") ; // retrieves the info that is stored into the app label
var theFile = File(theFile).openDlg() ; // retrieves the file name chosen by the user
Actually, I conditioned in the beginning of the script
if theFile == null then use the openDialog function, otherwise, use the openDlg function
Thanks!
Copy link to clipboard
Copied
I wonder that insertLabel coerces the fileObject to fsPath! But obviously it does. ..