In InDesign cc I have the "copy all link information" mapped to the keyboard shortcut shift+option+L. With a image selected, when the script is triggered it displays a dialogue box asking what needs to be done sets that to a variable, then runs the keystroke shift+option+L to copy the link info. Next it creates a text file on the desktop if its not there and appends it with the display box variable and pastes the link information. The problem is that it doesn't copy the link information correctly. Its as if its delayed. For example. If I copy something to the clipboard like the word "capture" and then select the image and run the script it will paste the word "capture" instead of the link information. But if I run it again on a different image it will paste the link information from the first time I ran the script. Its like its delayed by 1. Anyhow if anyone has any idea how to fix this strange behavior I would be grateful. Perhaps it would work with javascript, Im not sure.
Thanks,
~David
--dialog box
display dialog "What do you need done" default answer "Remove Background"
settheAnswerto (text returnedofresult)
activateapplication "Adobe InDesign CC 2015"
tellapplication "System Events" tokeystroke "L" using {shift down, option down}
end
setthis_storyto "
------------------- " & theAnswer& " -------------------
"
setthis_fileto (((path todesktop folder) asstring) & "ArtCorrections.txt")
mywrite_to_file(this_story, this_file, false)
onwrite_to_file(this_data, target_file, append_data)
try
setthetarget_filetothetarget_fileasstring
settheopen_target_filetoopen for accessfiletarget_filewithwrite permission
ifappend_dataistruethenset eofoftheopen_target_fileto 0
writethis_datatotheopen_target_filestarting ateof
close accesstheopen_target_file
returntrue
onerror
try
close accessfiletarget_file
endtry
returnfalse
endtry
endwrite_to_file
setmyVartothe clipboard
mywrite_to_file(myVar, this_file, false)
onwrite_clip_file(myVar, target_file, append_data)
try
setthetarget_filetothetarget_fileasstring
settheopen_target_filetoopen for accessfiletarget_filewithwrite permission
ifappend_dataistruethenset eofoftheopen_target_fileto 0
writemyVartotheopen_target_filestarting ateof
close accesstheopen_target_file
returntrue
onerror
try
close accessfiletarget_file
endtry
returnfalse
endtry
endwrite_clip_file