Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Javascript : Check if file is already open or not?

Engaged ,
Aug 03, 2017 Aug 03, 2017

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

TOPICS
Actions and scripting
4.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Engaged ,
Aug 03, 2017 Aug 03, 2017

Hi Everyone,

Any update or suggestion on below post?

-yajiv

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 04, 2017 Aug 04, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 06, 2017 Aug 06, 2017

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 06, 2017 Aug 06, 2017

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 07, 2017 Aug 07, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 11, 2017 Aug 11, 2017

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

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 11, 2017 Aug 11, 2017
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines