Le 19 avr. 2016 à 20:12, Jake Rowlands < email@hidden> a écrit :
Many thank you to Ed Stockly for helping me out with my first phase of an Adobe Illustrator relink script. With his help, the script is able to change the link location between three different libraries. There is a high resolution connected server library, a low resolution connected server mirror library of the high resolution (with minor change in folder hierarchy) and lastly a connected USB version of the low resolution library.
The USB is synced using box.com account and carbon copy cloner. However, Box does not fully support syncing to an external drive. I need to alter the script to allow relinking from the active user's home folder, despite user name. The script will currently link from high resolution or low resolution to the home folder Box Sync, but will not link back out of the home folder to high resolution nor low resolution.
Below is the script so far:
set BoxSync to (path to home folder as text) set LoResLink to "CG Master_LR" set HiResLink to "CG Master_HR" set NewExt1 to ".tif" set NewExt1Small to "-sm.tif" set ErrorList to {} set LinkInspect to {} tell application "Adobe Illustrator" activate set user interaction level to interact with all display dialog "Please chose link mode" buttons {"HiRes", "LoRes", "Box Sync"} default button 2
if the button returned of the result is "HiRes" then
set ErrorList to ErrorList & my LinkSwitch(document 1, LoResLink, HiResLink, 3, NewExt1) set ErrorList to ErrorList & my LinkSwitch(document 1, BoxSync, HiResLink, 5, NewExt1)
else if button returned of the result is "LoRes" then
set ErrorList to ErrorList & my LinkSwitch(document 1, HiResLink, LoResLink & ":Assets", 2, NewExt1Small) set ErrorList to ErrorList & my LinkSwitch(document 1, BoxSync, LoResLink & ":Assets", 5, NewExt1Small)
else
set ErrorList to ErrorList & my LinkSwitch(document 1, LoResLink, BoxSync & ":Box Sync:Assets", 3, NewExt1Small) set ErrorList to ErrorList & my LinkSwitch(document 1, HiResLink, BoxSync & ":Box Sync:Assets", 2, NewExt1Small)
end if
Thank you, Jake Rowlands
The problem is that you try to use several times the button returned of the result. Alas for you, when the instruction : if the button returned of the result is "HiRes" then is executed, result is no longer {button returned:"LoRes"}, it's the boolean false.
I can't test because I don't own/use Adobe Illustrator but I'm quite sure that the code below would work. It's in bare text because I can't compile Illustrator's instruction here.
set BoxSync to (path to home folder as text) set LoResLink to "CG Master_LR" set HiResLink to "CG Master_HR" set NewExt1 to ".tif" set NewExt1Small to "-sm.tif" set ErrorList to {} set LinkInspect to {}
# Put display dialog out of the tell Illustrator block because display dialog belong to Standard Additions, not to Illustrator display dialog "Please chose link mode" buttons {"HiRes", "LoRes", "Box Sync"} default button 2 set buttonReturned to button returned of result # Extract the button returned only once so it will be compared two times if necessary.
tell application "Adobe Illustrator" activate set user interaction level to interact with all
if buttonReturned is "HiRes" then
set ErrorList to ErrorList & my LinkSwitch(document 1, LoResLink, HiResLink, 3, NewExt1) set ErrorList to ErrorList & my LinkSwitch(document 1, BoxSync, HiResLink, 5, NewExt1)
else if buttonReturned is "LoRes" then
set ErrorList to ErrorList & my LinkSwitch(document 1, HiResLink, LoResLink & ":Assets", 2, NewExt1Small) set ErrorList to ErrorList & my LinkSwitch(document 1, BoxSync, LoResLink & ":Assets", 5, NewExt1Small)
else
set ErrorList to ErrorList & my LinkSwitch(document 1, LoResLink, BoxSync & ":Box Sync:Assets", 3, NewExt1Small) set ErrorList to ErrorList & my LinkSwitch(document 1, HiResLink, BoxSync & ":Box Sync:Assets", 2, NewExt1Small)
end if end
Yvan KOENIG running El Capitan 10.11.4 in French (VALLAURIS, France) mardi 19 avril 2016 21:25:46
|