How can we implement multithreading in indesign javascript?
In my script, i have a palette in which has images that are downloaded from the server. So, i want to seperate the UI with the dowloading process such that while the images are being downloaded in background, the user can perform actions with the palette. Else, the indesign will be hanged for the time it takes to download all the images.
Thnx for your reply..
I tried that, but no luck.
I have 2 files:
1. Download.jsx ---> downloads the data from server.
2. Application.jsx ----> main script that has the palette
I ran the "Download,jsx" script from "Application.jsx" script; and gave different targetengine to both.
The Indesign got hanged when i call "Download,jsx" for the time the image is downloaded.
But, i want that while the download process is done in background; user can work on the palette...
I'm afraid I can't help without seeing the scripts.
I had problems with the asynchronous resource downloads some time ago and
I decided not to use javascript for it. So my "Application.jsx" launched
external "Download.py" (Python) in the background, which started the download
without blocking InDesign at all.
The downside of it is that you may have hard time showing the download progress
to the user. If you want this you can have the external downloader write some
this-is-where-I-am kind of message to a temp file and have your palette
periodically look for its contents (with onIdle event) and display it as progress
message or construct some widget based on it. I never felt the need for it though,
as I have all my scripts write to a log so I can see it there. (less eye candy
but equally functional).
Harder part was to say goodbye to my pure javascript download code that
I crafted on top of the Socket object. But we have to accept that extendscript
is not omnipotent and when there is better tool for the job, I won't hesitate
to use it.
What happens when you execute "wget -b url -P pathToSave" from the command line? Do you have to watch the download process before you allowed to enter another command or does it go to background, doing its job and letting to work? '-background' option seems to do the trick on unix version of wget
North America
Europe, Middle East and Africa
Asia Pacific