Javascript : Check if file is already open or not?
Copy link to clipboard
Copied
Hi All,
I'm facing a requirement to check a CSV file that has been already opened by some other process.
We are using the file reading concepts to read the content of those CSV file.
If it is possible to check whether the CSV file open or not.
ANY GUIDANCE WILL BE HELPFUL...
- yajiv
Explore related tutorials & articles
Copy link to clipboard
Copied
Hi Everyone,
Any update or suggestion on below post?
-yajiv
Copy link to clipboard
Copied
I have a working solution on Windows 64bit, that use Paul Riggott's external lib and a small exe I have written that gets process titles of all process's that are running.
If this is of interest to you I will post the jsx and binary files with instructions.
Copy link to clipboard
Copied
Hi SuperMerlin,
Sorry for the late reply and Thank you so much for your response.
Actually I am working in Mac platform. If any suggestion/ solution for MAC?
-yajiv
Copy link to clipboard
Copied
Sorry I only have Windows machines. Maybe there will be a way of looking at the running process and checking the titles on a Mac?
Copy link to clipboard
Copied
A quick look on Google shows there might be a way usin AppleScript,,,
tell application "System Events" get name of every window of every processend tell
You would need to parse the output looking for the name of your csv file.
Copy link to clipboard
Copied
perhaps this could do the job:
var cnt = app.documents.length
myFile = "IMG_9134.JPG" // the file you are looking for
// check each opened file if it is the one you are looking for
for (var i = 0; i <cnt; i++) {
thisFile = app.documents.name
if (thisFile == myFile){
alert(app.documents + ' is opened')
break
}
}
Copy link to clipboard
Copied
It's a CSV file and these are not opened in Photoshop unless accessed by a script, so it will not show with app.documents.

