I have an Applescript that I need to convert to a Javascript.
I have read some of the documentation for Javascript but I am finding it tough.
Can anyone show me the equivalent Javascript for this Applescript
set the thefolder to alias "macHD:Users:Smith:Desktop:PDFs:"
tell application "Adobe InDesign CS3"
tell document 1
set the ADSTACK to every text frame whose label starts with "Product"
if (count of ADSTACK) = 1 then
set the AdLabel to label of item 1 of ADSTACK
set AdNumber to word 3 of AdLabel & ".pdf"
tell item 1 of ADSTACK
try
set thisAd to thefolder & AdNumber as text as alias
place thisAd
on error
display dialog "Ad not found" buttons {"Cancel"} with icon 1
end try
end tell
else
repeat with i from 1 to count of ADSTACK
set the AdLabel to label of item i of ADSTACK
set AdNumber to word 3 of AdLabel & ".pdf"
tell item i of ADSTACK
try
set thisAd to thefolder & AdNumber as text as alias
place thisAd
on error
display dialog AdNumber & " not found" buttons {"Cancel", "OK"} default button 2 with icon 1
end try
end tell
end repeat
end if
end tell
end tell