Scripting preferences
I'm working on a script that sets various preferences for InDesign and InCopy. My goal is to be able to set every preference that appears on every tab of the Preferences dialog in either application.
I've got most of them, but there are a few I can't nail down.
InCopy:
1. General tab: Enable attached scripts. (I'm assuming this can't be done with a script for security reasons.)
2. Type tab: Set the font preview size.
3. Grids tab: Set the "relative to" value for the baseline grid. (I can do this in InDesign, but the property seems to be read only for InCopy.)
4. Guides & Pasteboard tab: Set the minimum vertical offset value for the pasteboard. (I can do this in InDesign, but the property seems to be read only for InCopy.)
5. Display performance tab: all settings. (I can set all of these in InDesign, but can't find a way to get it done in InCopy.)
6. File Handling tab: enable/disable Version Cue.
InDesign:
1. Type tab: Set the font preview size
2. File Handling tab: Set snippet-import options and enable/disable Version Cue.
Thanks in advance for any pointers.
Yes, I've been through the object model upside down and sideways. The missing items that puzzle me the most are the ones that work in InDesign but don't seem to be supported (or are read only) in InCopy.
>>> "[Jongware]" <[email protected]> 8/23/2010 3:40 PM >>>
Did you go over all Preferences in the JS Help?
While checking for your Font Preview Size, I found a few mystifying ones in the General Preferences:
enableMultiTouchGestures
r/w
Controls whether or not multi-touch gestures are enabled.
objectsMoveWithPage
r/w
Controls whether page items move when a page is repositioned from the UI. The option/alt key temporarily reverses this property
.. and in ImageIOPreference, this one:
previewResolution
readonly
The image resolution in ppi, set when the graphic is imported.
(unfortunately it's read-only!).
(I didn't find either of your 2 missing items.)
Similar Messages
-
My InDesign to PDF script ignores warnings, but I need to change that.
Hello,
I have a script here that converts InDesign Docs to PDF files.
It works fine and was created to make bulk pdf's regardles of missing images.
Now I want to revise it so that it does stop for missing fonts and images.
This script also was built for quark and I can see where I could remove the supress all warnings dialog to remove it for the quark part, but I can't figure out where that warning is in the InDesign part to remove it.
Here is the script: If anyone can help me find out where this line of code is that I could remove, so that the script does stop if there are missing fonts and images, that would be great!!
property Babs_Folder : "Babs PDF Folder"
global deskPath
global PathToFolder
global PathToFolder2
global tempPictures
on open thefiles
tell application "Finder"
activate
set tempPictures to (every item of (get selection)) -- MUST GET BEFORE MAKING FOLDERS
if not (exists folder Babs_Folder) then make new folder with properties {name:Babs_Folder}
set deskPath to desktop as text
set PathToFolder to POSIX path of (deskPath & Babs_Folder)
set PathToFolder2 to deskPath & Babs_Folder & ":"
end tell
my openfiles()
say "Finished"
end open
on openfiles()
try
tell application "Finder"
repeat with LoopFiles in tempPictures
set foundImages to {}
if kind of LoopFiles = "Folder" then
try
set foundImages to files of entire contents of LoopFiles as list
on error
set foundImages to files of entire contents of LoopFiles
end try
else
if kind of LoopFiles is not in {"Volume", "Disk Image", "Application", "Web Internet Location", "Document", "Text Clipping"} then
set end of foundImages to LoopFiles
end if
end if
--set WorkingFile to item i of fileList
repeat with WorkingFile in foundImages
if not ((kind of WorkingFile starts with "Quark") or (kind of WorkingFile starts with "InDesign")) then
activate
display dialog "This file is not an InDesign or Quark document!" buttons "Skipping" default button "Skipping" with icon 0 giving up after 1
else
--Determine whether to use InDesign subroutines or Quark subroutines
if (kind of WorkingFile starts with "InDesign") then -- Process as InDesign
my createInDesignPDF(WorkingFile, PathToFolder2)
else -- Process as Quark
my createQuarkPDF(WorkingFile)
end if
end if
end repeat
end repeat
end tell
on error errmsg
display dialog "OpenFiles." & return & errmsg giving up after 20
end try
end openfiles
on createInDesignPDF(WorkingFile, savePath)
set x to 0
repeat
if x = 0 then
set newpart to ""
else
set newpart to " " & x
end if
tell application "Finder"
set tempname to my add_extension(WorkingFile, newpart, "pdf")
if not (exists file tempname in folder Babs_Folder) then exit repeat
end tell
set x to x + 1
end repeat
tell application "Adobe InDesign CS3"
try
try
set user interaction level of script preferences to never interact
end try
open WorkingFile as alias
delay 2
repeat
if exists document 1 then exit repeat
delay 0.2
end repeat
set theProps to properties of PDF export preset "[Press Quality]"
set newProps to {view PDF:false, crop marks:false, bleed marks:false, color bars:false, registration marks:false} & theProps
set oldProps to properties of PDF export preferences
set properties of PDF export preferences to newProps
export front document format PDF type to (savePath & tempname) without showing options
set properties of PDF export preferences to oldProps
delay 1
tell documents to close saving no
try
set user interaction level of script preferences to interact with all
end try
on error errmsg
display dialog "CreateIndesignPDF." & return & errmsg giving up after 20
end try
end tell
end createInDesignPDF
on createQuarkPDF(WorkingFile)
try
set x to 0
repeat
if x = 0 then
set newpart to ""
else
set newpart to " " & x
end if
tell application "Finder"
set tempname to my add_extension(WorkingFile, newpart, "pdf")
if not (exists file tempname in folder Babs_Folder) then exit repeat
end tell
set x to x + 1
end repeat
tell application "QuarkXPress"
activate
open WorkingFile as alias with Suppress All Warnings
tell application "System Events" to tell process "QuarkXPress"
click menu item "Layout as PDF..." of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
delay 1
keystroke tempname
delay 1
keystroke "G" using {shift down, command down}
delay 1
keystroke PathToFolder
delay 1
click button "Go" of sheet 1 of window "Export as PDF"
end tell
repeat 2 times
delay 1
activate
tell application "System Events" to tell process "QuarkXPress"
try
if exists button "OK" of window 1 then
click button "OK" of window 1
end if
end try
end tell
end repeat
delay 1
tell application "System Events" to tell process "QuarkXPress"
try
click button "Save" of window "Export as PDF"
end try
end tell
repeat 4 times
delay 1
activate
tell application "System Events" to tell process "QuarkXPress"
try
if exists button "OK" of window 1 then
click button "OK" of window 1
end if
end try
try
if exists button "List Profiles" of window 1 then
click button "Continue" of window 1
end if
end try
end tell
end repeat
delay 2
close front document saving no
end tell
on error errmsg
display dialog "CreateQuarkPDF." & return & errmsg giving up after 20
end try
end createQuarkPDF
on add_extension(WorkingFile, new_part, new_extension)
try
set this_info to info for WorkingFile as alias
set this_name to the name of this_info
set this_extension to the name extension of this_info
if this_extension is missing value then
set the default_name to this_name
else
set the default_name to text 1 thru -((length of this_extension) + 2) of this_name
end if
return (the default_name & new_part & "." & the new_extension)
on error errmsg
display dialog "add extension " & return & errmsg
end try
end add_extension
thanks!!!
babsHello,
OK-I had then blew it... ;-(
I was playing with a combination of removing (commenting out those two try areas you suggested), and that didn't do it on its own. It didn't do anything, it just said finished.
Then I found this in the dictionary ( set alert missing images to true) and added it to the script below. See my changes in Bold.
At one point, I was able to get the missing images dialog box. Then I don't know what happened, I think I tried to turn one of the try areas back on to test it, and then it stopped giving me that dialog box and only the one being asked in that on error errmsg - display dialog "CreateIndesignPDF." & return & errmsg giving up after 20, was showing up.
I commented out what I thought I had changed, but even after compiling and re-saving, I can't seem to get the missing images dialog box to show???
any thoughts?
thanks!!!
babs
property Babs_Folder : "Babs PDF Folder"
global deskPath
global PathToFolder
global PathToFolder2
global tempPictures
on open thefiles
tell application "Finder"
activate
set tempPictures to (every item of (get selection)) -- MUST GET BEFORE MAKING FOLDERS
if not (exists folder Babs_Folder) then make new folder with properties {name:Babs_Folder}
set deskPath to desktop as text
set PathToFolder to POSIX path of (deskPath & Babs_Folder)
set PathToFolder2 to deskPath & Babs_Folder & ":"
end tell
my openfiles()
say "Finished"
end open
on openfiles()
try
tell application "Finder"
repeat with LoopFiles in tempPictures
set foundImages to {}
if kind of LoopFiles = "Folder" then
try
set foundImages to files of entire contents of LoopFiles as list
on error
set foundImages to files of entire contents of LoopFiles
end try
else
if kind of LoopFiles is not in {"Volume", "Disk Image", "Application", "Web Internet Location", "Document", "Text Clipping"} then
set end of foundImages to LoopFiles
end if
end if
--set WorkingFile to item i of fileList
repeat with WorkingFile in foundImages
if not ((kind of WorkingFile starts with "Quark") or (kind of WorkingFile starts with "InDesign")) then
activate
display dialog "This file is not an InDesign or Quark document!" buttons "Skipping" default button "Skipping" with icon 0 giving up after 1
else
--Determine whether to use InDesign subroutines or Quark subroutines
if (kind of WorkingFile starts with "InDesign") then -- Process as InDesign
my createInDesignPDF(WorkingFile, PathToFolder2)
else -- Process as Quark
my createQuarkPDF(WorkingFile)
end if
end if
end repeat
end repeat
end tell
on error errmsg
display dialog "OpenFiles." & return & errmsg giving up after 20
end try
end openfiles
on createInDesignPDF(WorkingFile, savePath)
set x to 0
repeat
if x = 0 then
set newpart to ""
else
set newpart to " " & x
end if
tell application "Finder"
set tempname to my add_extension(WorkingFile, newpart, "pdf")
if not (exists file tempname in folder Babs_Folder) then exit repeat
end tell
set x to x + 1
end repeat
tell application "Adobe InDesign CS3"
try
--try
--set user interaction level of script preferences to never interact
--end try
open WorkingFile as alias
set alert missing images to true
delay 2
repeat
if exists document 1 then exit repeat
delay 0.2
end repeat
set theProps to properties of PDF export preset "[Press Quality]"
set newProps to {view PDF:false, crop marks:false, bleed marks:false, color bars:false, registration marks:false} & theProps
set oldProps to properties of PDF export preferences
set properties of PDF export preferences to newProps
export front document format PDF type to (savePath & tempname) without showing options
set properties of PDF export preferences to oldProps
delay 1
tell documents to close saving no
--try
--set user interaction level of script preferences to interact with all
--end try
on error errmsg
display dialog "CreateIndesignPDF." & return & errmsg giving up after 20
end try
end tell
end createInDesignPDF
on createQuarkPDF(WorkingFile)
try
set x to 0
repeat
if x = 0 then
set newpart to ""
else
set newpart to " " & x
end if
tell application "Finder"
set tempname to my add_extension(WorkingFile, newpart, "pdf")
if not (exists file tempname in folder Babs_Folder) then exit repeat
end tell
set x to x + 1
end repeat
tell application "QuarkXPress"
activate
open WorkingFile as alias with Suppress All Warnings
tell application "System Events" to tell process "QuarkXPress"
click menu item "Layout as PDF..." of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
delay 1
keystroke tempname
delay 1
keystroke "G" using {shift down, command down}
delay 1
keystroke PathToFolder
delay 1
click button "Go" of sheet 1 of window "Export as PDF"
end tell
repeat 2 times
delay 1
activate
tell application "System Events" to tell process "QuarkXPress"
try
if exists button "OK" of window 1 then
click button "OK" of window 1
end if
end try
end tell
end repeat
delay 1
tell application "System Events" to tell process "QuarkXPress"
try
click button "Save" of window "Export as PDF"
end try
end tell
repeat 4 times
delay 1
activate
tell application "System Events" to tell process "QuarkXPress"
try
if exists button "OK" of window 1 then
click button "OK" of window 1
end if
end try
try
if exists button "List Profiles" of window 1 then
click button "Continue" of window 1
end if
end try
end tell
end repeat
delay 2
close front document saving no
end tell
on error errmsg
display dialog "CreateQuarkPDF." & return & errmsg giving up after 20
end try
end createQuarkPDF
on add_extension(WorkingFile, new_part, new_extension)
try
set this_info to info for WorkingFile as alias
set this_name to the name of this_info
set this_extension to the name extension of this_info
if this_extension is missing value then
set the default_name to this_name
else
set the default_name to text 1 thru -((length of this_extension) + 2) of this_name
end if
return (the default_name & new_part & "." & the new_extension)
on error errmsg
display dialog "add extension " & return & errmsg
end try
end add_extension -
How to avoid missing font dialog box(alert) while running the script??
Hi....
In Illustrator CS4 ,I tried to skip missing font dialog box(alert box) by using the following script .But,I could not skip the dialog box
So if you have any suggestion about this let me know..
tell application "Finder"
set user interaction level to never interact
activate
set fileName to (path to desktop folder as string) & "fer11757_f1208.eps"
--set user interaction level to never interact
-- set user interaction level of script preferences to never interact
open file fileName
--set alert missing fonts to true
set user interaction level to never interact
activate
end tell
display dialog ("completed")
end tell
Thanks,
MubeenDoes this NOT error when run? Your target application here is 'Finder' Apple's system file browser and you are giving it Adobe illustrator commands?
Im not 100% about the versioning with Illustrator installs I think they are all just…
Tell application "Adobe Illustrator" -- No CS Versioning?
-- do stuff here
end tell
you could check by just picking the app from this list
choose application -
tell application "Finder"
activate
set thefolder to choose folder with prompt "Select a Folder with InDesign Files to be Printed" as text
set thePath to thefolder as text
set the selected_items to every item of folder thefolder
if the selected_items is {} then
beep
display dialog "Please select a folder with InDesign files before running this script." buttons {"Cancel"} default button 1
end if
repeat with aFile in selected_items
tell application "Adobe InDesign CS6"
activate
with timeout of 600 seconds
set user interaction level of script preferences to never interact
open aFile
tell document 1
tell print preferences
set active printer preset to "Catalog Pages"
set page range to all pages
end tell
print without print dialog
close saving no
end tell
end timeout
--might need this delay
--delay 10
set user interaction level of script preferences to interact with all
end tell
end repeat
tell application "Finder"
activate
display dialog "Batch Printing is complete!" giving up after 5
end tell
end tellHi
After I put a small delay in as shown, your code ran fine, tested on about twenty ID files, using ID CC 2014, OSX 10.10.2
tell document 1
delay 0.5 -- delay added
tell print preferences
set active printer preset to "Catalog Pages" -
"MakeGrid" scripts in InDesign CS3 aren't working
Hello -
I have an interesting problem: most of my scripts stopped working last week. I don't know if I accidently hit some keyboard shortcut disabling things, or what. I have one java script ( add guides ) that still works but most of the others don't. I've tried resetting preferences but that hasn't worked. General, I know... but I thought maybe someone else had run into this too.
thanks -I have a feeling the last script you ran turned off user interaction and didn't turn it back on when it finished.
Try running this one-liner:
//Dave Saunders
//Resets script preference
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll; -
How to handle relative folders in script
Just say I have the following folder: C:\test
Inside there is one file, install.sql, and a folder 'addons' with the file three.sql
How should I run install.sql in SQL Dev?
install.sql:
@@addons/three.sql;
@@c:\test\install.sql results in:
Error starting at line 4 in command:
@@addons/three.sql
Error report:
Unable to open file: "addons/three.sql"
This is a basic example. The actual application is for install pl/json... It has the following lines in the install script:
PROMPT ------------------------------------------;
PROMPT -- Adding optional packages for PL/JSON --;
PROMPT ------------------------------------------;
@@addons/json_dyn.sql --dynamic sql execute
@@addons/jsonml.sql --jsonml (xml to json)
@@addons/json_xml.sql --json to xml copied from http://www.json.org/java/org/json/XML.java
@@addons/json_util_pkg.sql --dynamic sql from http://ora-00001.blogspot.com/2010/02/ref-cursor-to-json.html
@@addons/json_helper.sql --Set operations on JSON and JSON_LIST
But running @@C:\pljson\install.sql
-- Adding optional packages for PL/JSON --
Error starting at line 52 in command:
@@addons/json_dyn.sql --dynamic sql execute
Error report:
Unable to open file: "addons/json_dyn.sql"
Error starting at line 53 in command:
@@addons/jsonml.sql --jsonml (xml to json)
Error report:
Unable to open file: "addons/jsonml.sql"
Error starting at line 54 in command:
@@addons/json_xml.sql --json to xml copied from http://www.json.org/java/org/json/XML.java
Error report:
Unable to open file: "addons/json_xml.sql"
Error starting at line 55 in command:
@@addons/json_util_pkg.sql --dynamic sql from http://ora-00001.blogspot.com/2010/02/ref-cursor-to-json.html
Error report:
Unable to open file: "addons/json_util_pkg.sql"
Error starting at line 56 in command:
@@addons/json_helper.sql --Set operations on JSON and JSON_LIST
Error report:
Unable to open file: "addons/json_helper.sql"This is SQL*Plus compatible - i.e. the expected behaviour. Although I have to say it took me by surprise until I tested it.
As you can see from the example below, it doesn't work in sqlplus either, unless your current directory is where install.sql is.
You can make it work in SQL Developer by setting the Select default path to look for scripts preference to the location of install.sql
C:\Documents and Settings\Administrator>sqlplus jim/xxxxx@xe
SQL*Plus: Release 11.2.0.3.0 Production on Sat Aug 17 12:28:32 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
jim@XE> @q:\dev\scratch\install
SP2-0310: unable to open file "addons\test1.sql"
jim@XE> quit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
C:\Documents and Settings\Administrator>q:
Q:\>cd \dev\scratch
Q:\dev\scratch>sqlplus jim/xxxx@xe
SQL*Plus: Release 11.2.0.3.0 Production on Sat Aug 17 12:29:33 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
jim@XE> @install
'TEST
test1
1 row selected.
Elapsed: 00:00:00.00
jim@XE> -
Parallel Backup script written in python
I'm writing a backup script in python, based on one I wrote in BASH earlier on. Both of these leverage rsync, but I decided to move to a python implementation because python is much more flexible than BASH. My goals with the new implementation are to back up the system, home folder, and my documents folder to a set of multiple primary, secondary, and tertiary disks, respectively. The method is as follows:
1. check for the existence of disks and create folders which will contain mountpoints for each category of disk.
2. decrypt and mount disks found under subfolders within those category folders, creating the mountpoints if they don't exist.
3. syncronize the aforementioned data to the mounted disks using rsync, doing all three classes of disk in parallel.
4. unmount and close disks
This is really my first serious python program, and I realize that it's a bit complicated. My code is rather sloppy, as well, perhaps understandably so given my novice status. My only other programming experience is with BASH scripts, but I digress.
Here is the code for the script (about 250 lines). It is written as a series of functions, and I'm uncertain as to whether functions or objects would work better. Additionally, I'm sure there's a python function provided by the os module analogous to the sync system call, but I've yet to find it in my python desk reference. The backup functions need work, and I'm still trying to figure out how to get them to loop through the mounted disks in each folder and copy to them. I require assistance in determining how to write the backup functions to do as outlined above, and how to run them in parallel. This is still a work in progress, mind.
#!/usr/bin/python
# Backup Script
#### preferences ####
# set your primary/secondary backup disks, encryption, and keyfile (if applicable) here.
# backup disks
# primary and secondary backups. As used here,
# primary backups refer to backups of the entire system made to an external drive
# secondary backups refer to backups made of individual folders, such as documents
# primary backup disks by UUID:
global PDISKS
PDISKS = ("/dev/disk/by-uuid/16d64026-28bd-4e1f-a452-74e76bb4d47b","")
# secondary backups by UUID.
global SDISKS
SDISKS = ()
# tertiary disks by UUID:
global TDISKS
TDISKS = ("/dev/disk/by-uuid/39543e6e-cf50-4416-9669-e97a6abd2a37","")
# backup paths
# these are the paths of the folders you wish to back up to secondary
# and tertiary disks, respectively. Primary disks are set to back up the
# contents of the root filesystem (/*). NO TRAILING SLASHES.
global SBACKUP
SBACKUP = "/home/bryant"
global TBACKUP
TBACKUP = "/home/bryant/docs"
# use encryption:
use_encryption = True
# keyfile
# set the full path to your keyfile here
# this assumes a single keyfile for all backup disks
# set this to None if you don't have a single keyfile for all of your backups
keyfile = "/usr/local/bin/backup.keyfile"
# import modules
import os, subprocess, sys
### preliminary functions ###
# these do the setup and post-copy work
def check_dirs():
"""checks that the folders which contain the mountpoints exist, creates them if they don't"""
print("checking for mountpoints...")
p = os.path.isdir("/mnt/pbackup")
if p == True:
print("primary mountpoint exists.")
elif p == False:
print("mountpoint /mnt/pbackup does not exist.\n\tcreating...")
os.mkdir("/mnt/pbackup")
s = os.path.isdir("/mnt/sbackup")
if s == True:
print("secondary mountpoint exists.")
elif s == False:
print("mountpoint /mnt/pbackup does not exist.\n\tcreating...")
os.mkdir("/mnt/sbackup")
t = os.path.isdir("/mnt/tbackup")
if t == True:
print("tertiary mountpoint exists.")
elif t == False:
print("mountpoint /mnt/tbackup does not exist.\n\tcreating...")
os.mkdir("/mnt/tbackup")
def mount_disks():
"""mounts available backup disks in their respective subdirectories"""
pfolder = 1
sfolder = 1
tfolder = 1
pmapper = "pbackup" + str(pfolder)
smapper = "sbackup" + str(sfolder)
tmapper = "tbackup" + str(tfolder)
for pdisk in PDISKS:
e = os.path.islink(pdisk)
if e == True:
subprocess.call("sync",shell=True)
kf=os.path.isfile(keyfile)
if kf == True:
print("keyfile found. Using keyfile to decrypt...")
subprocess.call("sudo cryptsetup luksOpen " + pdisk + " " + pmapper + " --key-file " + keyfile,shell=True)
if kf == False:
print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
subprocess.call("sudo cryptsetup luksOpen " + pdisk + " " + pmapper,shell=True)
f = os.path.isdir("/mnt/pbackup/pbak" + str(pfolder))
if f == True:
subprocess.call("mount " + "/dev/mapper/" + pmapper + " /mnt/pbak" + str(pfolder),shell=True)
pfolder += 1
elif f == False:
os.mkdir("/mnt/pbackup/pbak" + str(pfolder))
subprocess.call("mount " + "/dev/mapper/" + pmapper + " /mnt/pbak" + str(pfolder),shell=True)
pfolder += 1
for sdisk in SDISKS:
e = os.path.islink(sdisk)
if e == True:
subprocess.call("sync",shell=True)
kf=os.path.isfile(keyfile)
if kf == True:
print("keyfile found. Using keyfile to decrypt...")
subprocess.call("sudo cryptsetup luksOpen " + sdisk + " " + smapper + " --key-file " + keyfile,shell=True)
if kf == False:
print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
subprocess.call("sudo cryptsetup luksOpen " + sdisk + " " + smapper,shell=True)
f = os.path.isdir("/mnt/sbackup/sbak" + str(sfolder))
if f == True:
subprocess.call("mount " + "/dev/mapper/" + smapper + " /mnt/sbackup/sbak" + str(sfolder),shell=True)
sfolder += 1
elif f == False:
os.mkdir("/mnt/sbackup/sbak" + str(folder))
subprocess.call("mount " + "/dev/mapper/" + smapper + " /mnt/sbackup/sbak" + str(sfolder),shell=True)
sfolder += 1
for tdisk in TDISKS:
e = os.path.islink(tdisk)
if e == True:
subprocess.call("sync",shell=True)
kf=os.path.isfile(keyfile)
if kf == True:
print("keyfile found. Using keyfile to decrypt...")
subprocess.call("sudo cryptsetup luksOpen " + tdisk + " " + tmapper + " --key-file " + keyfile,shell=True)
if kf == False:
print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
subprocess.call("sudo cryptsetup luksOpen " + tdisk + " " + tmapper,shell=True)
f = os.path.isdir("/mnt/tbackup/tbak" + str(tfolder))
if f == True:
subprocess.call("mount " + "/dev/mapper/" + tmapper + " /mnt/pbak" + str(tfolder),shell=True)
tfolder += 1
elif f == False:
os.mkdir("/mnt/tbackup/tbak" + str(tfolder))
subprocess.call("mount " + "/dev/mapper/" + tmapper + " /mnt/tbak" + str(tfolder),shell=True)
tfolder += 1
def umount_disks():
"""unmounts and relocks disks"""
subprocess.call("umount /mnt/pbackup*",shell=True)
subprocess.call("umount /mnt/sbackup*",shell=True)
subprocess.call("umount /mnt/tbackup*",shell=True)
subprocess.call("cryptsetup luksClose /dev/mapper/pbackup*",shell=True)
subprocess.call("cryptsetup luksClose /dev/mapper/sbackup*",shell=True)
subprocess.call("cryptsetup luksClose /dev/mapper/tbackup*",shell=True)
def check_disks():
"""checks to see how many disks exist, exits program if none are attached"""
pdisknum = 0
sdisknum = 0
tdisknum = 0
for pdisk in PDISKS:
p = os.path.islink(pdisk)
if p == True:
pdisknum += 1
elif p == False:
print("disk " + pdisk + " not detected.")
for sdisk in SDISKS:
s = os.path.islink(sdisk)
if s == True:
sdisknum += 1
elif s == False:
print("disk " + sdisk + " not detected.")
for tdisk in TDISKS:
t = os.path.islink(tdisk)
if t == True:
tdisknum += 1
elif t == False:
print("disk " + tdisk + " not detected.")
total = pdisknum + sdisknum + tdisknum
if total == 0:
print("ERROR: no disks detected.")
sys.exit()
elif total > 0:
print("found " + str(total) + " attached backup disks")
print(str(pdisknum) + " Primary")
print(str(sdisknum) + " secondary")
print(str(tdisknum) + " tertiary")
return total, pdisknum, sdisknum, tdisknum
### backup functions ###
# these need serious work. Need to get them to loop through available mounted
# disks in their categories and then execute rsync
def pbackup():
"""calls rsync to backup the entire system to all pdisks"""
dirs = os.listdir("/mnt/pbackup")
for dir in dirs:
m = os.path.ismount(dir)
if m == True:
subprocess.call("sync",shell=True)
print("syncing disks with rsync...")
# subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} /* /mnt/pbackup/" + dir + "/ --exclude={/sys/*,/mnt/*,/proc/*,/dev/*,/lost+found,/media/*,/tmp/*,/home/*/.gvfs/*,/home/*/downloads/*,/opt/*,/run/*",shell=True)
print("test1")
subprocess.call("sync",shell=True)
print("disk synced with disk " + pdisk + ".")
print("sync with disk " + pdisk + " complete.")
elif m == False:
continue
def sbackup():
"""calls rsync to backup everything under SBACKUP folder to all sdisks"""
dirs = os.listdir("/mnt/sbackup")
for dir in dirs:
m = os.path.ismount(dir)
if m == True:
subprocess.call("sync",shell=True)
# subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} SBACKUP/* /mnt/sbackup/" + dir + "/",shell=True)
print("test2")
subprocess.call("sync",shell=True)
print("disk synced with disk " + pdisk + ".")
print("sync with disk " + sdisk + " complete.")
elif m == False:
continue
def tbackup():
"""calls rsync to backup everything under TBACKUP folder to all tdisks"""
dirs = os.listdir("/mnt/tbackup")
for dir in dirs:
m = os.path.ismount(dir)
if m == True:
subprocess.call("sync",shell=True)
# subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} TBACKUP/* /mnt/sbackup/" + dir + "/",shell=True)
print("test3")
subprocess.call("sync",shell=True)
print("disk synced with disk " + pdisk + ".")
print("sync with disk " + sdisk + " complete.")
elif m == False:
continue
#### main ####
# check for root access:
r=os.getuid()
if r != 0:
print("ERROR: script not run as root.\n\tThis script MUST be run as root user.")
sys.exit()
elif r == 0:
# program body
check_dirs()
check_disks()
mount_disks()
# pbackup()
# sbackup()
tbackup()
umount_disks()
print("backup process complete.")
Last edited by ParanoidAndroid (2013-08-07 20:01:07)I've run into a problem on line 149. I'm asking the program to list the directories under the top-level backup directories under /mnt, check to see if each one is a mountpoint, and if it is unmount it. It does this, but it appears to recurse into the directories under the directories I'm asking it to check. The output is:
checking for mountpoints...
primary mountpoint exists.
secondary mountpoint exists.
tertiary mountpoint exists.
disk /dev/disk/by-uuid/16d64026-28bd-4e1f-a452-74e76bb4d47b not detected.
found 1 attached backup disks
0 Primary
0 secondary
1 tertiary
keyfile found. Using keyfile to decrypt...
mounting tbackup1 at /mnt/tbak1
test3
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
not a mountpoint
Device /dev/mapper/pbackup* is not active.
Device /dev/mapper/sbackup* is not active.
backup process complete.
here is the code for the entire script. It's been much modified from the previously posted version, so I included all of the code versus the section in question for reference. As I said, the section that seems to be causing the issue is on line 149.
#!/usr/bin/python
# Backup Script
#### preferences ####
# set your primary/secondary backup disks, encryption, and keyfile (if applicable) here.
# backup disks
# primary and secondary backups. As used here,
# primary backups refer to backups of the entire system made to an external drive
# secondary backups refer to backups made of individual folders, such as documents
# primary backup disks by UUID:
global PDISKS
PDISKS = ["/dev/disk/by-uuid/16d64026-28bd-4e1f-a452-74e76bb4d47b"]
# secondary backups by UUID.
global SDISKS
SDISKS = []
# tertiary disks by UUID:
global TDISKS
TDISKS = ["/dev/disk/by-uuid/39543e6e-cf50-4416-9669-e97a6abd2a37"]
# backup paths
# these are the paths of the folders you wish to back up to secondary
# and tertiary disks, respectively. Primary disks are set to back up the
# contents of the root filesystem (/*). NO TRAILING SLASHES.
global SBACKUP
SBACKUP = "/home/bryant"
global TBACKUP
TBACKUP = "/home/bryant/docs"
# use encryption:
use_encryption = True
# keyfile
# set the full path to your keyfile here
# this assumes a single keyfile for all backup disks
# set this to None if you don't have a single keyfile for all of your backups
keyfile = "/usr/local/bin/backup.keyfile"
# import modules
import os, subprocess, sys
### preliminary functions ###
# these do the setup and post-copy work
def check_dirs():
"""checks that the folders which contain the mountpoints exist, creates them if they don't"""
print("checking for mountpoints...")
if os.path.isdir("/mnt/pbackup"):
print("primary mountpoint exists.")
else:
print("mountpoint /mnt/pbackup does not exist.\n\tcreating...")
os.mkdir("/mnt/pbackup")
if os.path.isdir("/mnt/sbackup"):
print("secondary mountpoint exists.")
else:
print("mountpoint /mnt/pbackup does not exist.\n\tcreating...")
os.mkdir("/mnt/sbackup")
if os.path.isdir("/mnt/tbackup"):
print("tertiary mountpoint exists.")
else:
print("mountpoint /mnt/tbackup does not exist.\n\tcreating...")
os.mkdir("/mnt/tbackup")
def mount_disks(wdisk):
"""mounts available backup disks in their respective subdirectories"""
pfolder = 1
sfolder = 1
tfolder = 1
pmapper = "pbackup"
smapper = "sbackup"
tmapper = "tbackup"
if wdisk == "p":
for pdisk in PDISKS:
if os.path.islink(pdisk):
subprocess.call("sync",shell=True)
if os.path.isfile(keyfile):
print("keyfile found. Using keyfile to decrypt...")
subprocess.call("sudo cryptsetup luksOpen " + pdisk + " " + pmapper + str(pfolder) + " --key-file " + keyfile,shell=True)
else:
print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
subprocess.call("sudo cryptsetup luksOpen " + pdisk + " " + pmapper + str(pfolder),shell=True)
if os.path.isdir("/mnt/pbackup/pbak" + str(pfolder)):
print("mounting " + pmapper + str(pfolder) + " at /mnt/pbak" + str(pfolder))
subprocess.call("mount " + "/dev/mapper/" + pmapper + str(pfolder) + " /mnt/pbackup/pbak" + str(pfolder),shell=True)
pfolder += 1
else:
os.mkdir("/mnt/pbackup/pbak" + str(pfolder))
subprocess.call("mount " + "/dev/mapper/" + pmapper + str(pfolder) + " /mnt/pbackup/pbak" + str(pfolder),shell=True)
pfolder += 1
elif wdisk == "s":
for sdisk in SDISKS:
if os.path.islink(sdisk):
subprocess.call("sync",shell=True)
if os.path.isfile(keyfile):
print("keyfile found. Using keyfile to decrypt...")
subprocess.call("sudo cryptsetup luksOpen " + sdisk + " " + smapper + str(sfolder) + " --key-file " + keyfile,shell=True)
else:
print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
subprocess.call("sudo cryptsetup luksOpen " + sdisk + " " + smapper + str(sfolder),shell=True)
if os.path.isdir("/mnt/sbackup/sbak" + str(sfolder)):
print("mounting " + smapper + str(sfolder) + " at /mnt/sbak" + str(sfolder))
subprocess.call("mount " + "/dev/mapper/" + smapper + str(sfolder) + " /mnt/sbackup/sbak" + str(sfolder),shell=True)
sfolder += 1
else:
os.mkdir("/mnt/sbackup/sbak" + str(folder))
subprocess.call("mount " + "/dev/mapper/" + smapper + str(sfolder) + " /mnt/sbackup/sbak" + str(sfolder),shell=True)
sfolder += 1
elif wdisk == "t":
for tdisk in TDISKS:
if os.path.islink(tdisk):
subprocess.call("sync",shell=True)
if os.path.isfile(keyfile):
print("keyfile found. Using keyfile to decrypt...")
subprocess.call("sudo cryptsetup luksOpen " + tdisk + " " + tmapper + str(tfolder) + " --key-file " + keyfile,shell=True)
else:
print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
subprocess.call("sudo cryptsetup luksOpen " + tdisk + " " + tmapper + str(tfolder),shell=True)
if os.path.isdir("/mnt/tbackup/tbak" + str(tfolder)):
print("mounting " + tmapper + str(tfolder) + " at /mnt/tbak" + str(tfolder))
subprocess.call("mount " + "/dev/mapper/" + tmapper + str(tfolder) + " /mnt/tbackup/tbak" + str(tfolder),shell=True)
if os.path.islink(tdisk):
tfolder += 1
else:
os.mkdir("/mnt/tbackup/tbak" + str(tfolder))
subprocess.call("mount " + "/dev/mapper/" + tmapper + " /mnt/tbackup/tbak" + str(tfolder),shell=True)
tfolder += 1
def umount_disks():
"""unmounts and relocks disks"""
pdirs = os.listdir("/mnt/pbackup")
sdirs = os.listdir("/mnt/sbackup")
tdirs = os.listdir("/mnt/tbackup")
for pdir in pdirs:
if os.path.ismount("/mnt/pbackup/" + pdir):
subprocess.call("umount /mnt/pbackup/" + pdir,shell=True)
else:
print("not a mountpoint")
for sdir in sdirs:
if os.path.ismount("/mnt/sbackup/" + sdir):
subprocess.call("umount /mnt/sbackup/" + sdir,shell=True)
else:
print("not a mountpoint")
for tdir in tdirs:
if os.path.ismount("/mnt/tbackup/" + tdir):
subprocess.call("umount /mnt/tbackup/" + tdir,shell=True)
else:
print("not a mountpoint")
subprocess.call("cryptsetup luksClose /dev/mapper/pbackup*",shell=True)
subprocess.call("cryptsetup luksClose /dev/mapper/sbackup*",shell=True)
subprocess.call("cryptsetup luksClose /dev/mapper/tbackup*",shell=True)
def check_disks():
"""checks to see how many disks exist, exits program if none are attached"""
pdisknum = 0
sdisknum = 0
tdisknum = 0
for pdisk in PDISKS:
if os.path.islink(pdisk):
pdisknum += 1
else:
print("\ndisk " + pdisk + " not detected.")
for sdisk in SDISKS:
if os.path.islink(sdisk):
sdisknum += 1
else:
print("\ndisk " + sdisk + " not detected.")
for tdisk in TDISKS:
if os.path.islink(tdisk):
tdisknum += 1
else:
print("\ndisk " + tdisk + " not detected.")
total = pdisknum + sdisknum + tdisknum
if total == 0:
print("\nERROR: no disks detected.")
sys.exit()
elif total > 0:
print("found " + str(total) + " attached backup disks")
print(str(pdisknum) + " Primary")
print(str(sdisknum) + " secondary")
print(str(tdisknum) + " tertiary")
return total, pdisknum, sdisknum, tdisknum
### backup functions ###
# these need serious work. Need to get them to loop through available mounted
# disks in their categories and then execute rsync
def pbackup():
"""calls rsync to backup the entire system to all pdisks"""
dirs = os.listdir("/mnt/pbackup")
for dir in dirs:
if os.path.ismount("/mnt/pbackup/" + dir) == True:
subprocess.call("sync",shell=True)
print("syncing disks with rsync...")
subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} /* /mnt/pbackup/" + dir + "/ --exclude={/sys/*,/mnt/*,/proc/*,/dev/*,/lost+found,/media/*,/tmp/*,/home/*/.gvfs/*,/home/*/downloads/*,/opt/*,/run/*",shell=True)
subprocess.call("sync",shell=True)
else:
continue
def sbackup():
"""calls rsync to backup everything under SBACKUP folder to all sdisks"""
dirs = os.listdir("/mnt/sbackup")
for dir in dirs:
if os.path.ismount("/mnt/sbackup/" + dir):
subprocess.call("sync",shell=True)
subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} " + SBACKUP + "/* /mnt/sbackup/" + dir + "/",shell=True)
subprocess.call("sync",shell=True)
else:
continue
def tbackup():
"""calls rsync to backup everything under TBACKUP folder to all tdisks"""
dirs = os.listdir("/mnt/tbackup")
for dir in dirs:
if os.path.ismount("/mnt/tbackup/" + dir):
subprocess.call("sync",shell=True)
subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} " + TBACKUP + "/* /mnt/sbackup/" + dir + "/",shell=True)
subprocess.call("sync",shell=True)
else:
continue
#### main ####
# check for root access:
r=os.getuid()
if r != 0:
print("ERROR: script not run as root.\n\tThis script MUST be run as root user.")
sys.exit()
elif r == 0:
# program body
check_dirs()
d=check_disks()
if d[1] > 0:
mount_disks("p")
pbackup()
elif d[2] > 0:
mount_disks("s")
sbackup()
elif d[3] > 0:
mount_disks("t")
tbackup()
umount_disks()
print("backup process complete.")
Last edited by ParanoidAndroid (2013-08-11 00:32:02) -
Startup script to load shortcuts - in a Citrix environment
Let me offer a sample of what I have and ask if anyone knows how to fill in the gaps.
For starters, a listening script upon booting up InDesign:
#target InDesign
#targetengine session
//collect the name of current user
var userName = getUser();
function getUser() {
var myUser = ($.os.substring(0, 7)=="Windows")
? $.getenv("USERNAME")
: $.getenv("USER");
return myUser;
// var startupScriptsFolder = "/z/Scripting/Startup scripts/";
var startupScriptsFolder = "/Applications/Adobe InDesign CC/Scripts/startup scripts/";
var startupScriptFiles = Folder(startupScriptsFolder).getFiles();
for (var i = 0; i < startupScriptFiles.length; i++) {
app.doScript(startupScriptFiles[i]);
then the script itself:
#target InDesign
#targetengine session
//get or create folder for script preferences
var scriptPrefsFolderPath = "/Users/madmac55/Library/Preferences/Adobe InDesign/Version 9.0/en_US/InDesign Shortcut Sets/";
if (Folder(scriptPrefsFolderPath).exists == false) {
Folder(scriptPrefsFolderPath).create();
var locationPrefsFilePath = scriptPrefsFolderPath + "/ MyShortcuts.indk";
This hasn't worked for me and it's a hacked solution at best. So I am wondering how to get it all to click. In a Citrix environment (windows), Adobe puts the preferences in a hidden folder path ~/AppData/Roaming/ and this is where it's tough to find them — on the server(s) you land on.
Because you land on an arbitrary server, you have to run the getUser statement first, then drill down inside. I realize I have mixed paths of Mac & PC, and I'm really writing abiout a PC environment, but paths are interchangeable. It's the script that counts.Hey Mac,
I'm not sure if this will work for you as I've only used it when making .bat files... but, in Windows, you can reference the folder directly by using the variable "%USERNAME%"
C:\Users\%USERNAME%\AppData\Roaming\Adobe\InDesign\Version 5.0\Scripts\Scripts Panel\
Hope it helps. -
Missing bridge startup scripts
In bridge CS4 I am trying to use the Output feature to create a PDF contact sheet. However, when I click on that, I get a new workspace but I get no features in the output panel, it's blank. In reading the bridge PDF help manual, it says that one should use the Adobe Output Module script to do this: "If the Output workspace is not listed, select Adobe Output Module in Startup Scripts preferences." However, when I go to Preferences, Startup Scripts, and select "reveal scripts" there are no scripts shown at all.
Where can I find them? Is this also why when I select the "Tools" menu item, there is no "Photomerge" choice?I have gone to Bridge->Preferences->Startup script panel. The Adobe Output Module is not listed. In fact, there is nothing listed in the panel.
I have installed Photoshop CS4 but the photomerge options do not appear on the Tools->Photoshop menu of Bridge as they did in CS3. The only choices that appear are "Batch rename", 4 Metadata items, and "Cache". -
Problem GUI scripting an inDesign dialog box
I've posted this on the inDesign forums, but haven't received any answers.
I'm trying to automate the opening of .indd files with InDesign CS3. Naturally they often come in folders with attached/included linked files, and opening the .indd files results in a dialog box offering to 'Fix Links Automatically'
Trouble is, there's a dialog default button 'Don't Fix', that is selected when sending a return to the inDesign process (that works OK).
I'd like to select the 'Fix Links Automatically' button, but trying to send a click to the button doesn't work. I can get the button to flicker with multiple 'clicks', both by GUI addressing by name and by position, but the button won't respond. Even 20 consecutive clicks turns the button blue, but doesn't work.
I think it's a bug, but is it Adobe InDesigns or Apples?.
Any thoughts anyone?
Regards
SantaThanks Budgie
Turns out it's easy to tuen of the dialogs, and re-do links after opening the document.
tell application "Adobe InDesign CS3"
try
activate
set user interaction level of script preferences to never interact
open theItem
delay 5
set myDocument to document 1
tell myDocument to update links
set myFontCheck to (count (every font of document 1 whose status is not installed)) = 0
if not myFontCheck then say "[[rate " & TheSpeechRate & "]]There are fonts missing. " using TheVoice
set myGraphicsCheck to true
set myGraphics to all graphics of myDocument
repeat with myCounter from 1 to count myGraphics
set myGraphic to item myCounter of all graphics of myDocument
set myLink to item link of myGraphic
if status of myLink is not normal then
set myGraphicsCheck to false
if SpeakTheErrors then say "[[rate " & TheSpeechRate & "]]There are linked graphics missing. " using TheVoice
exit repeat
end if
end repeat
end tell -
Javascript preferences error when clicking insert
hi,
i tried looking around on the net however no solution i could see for this.
when i click insert in DW CS3 i get an error in "yy/scripts/preferences.js" error 3
i cannot see that file in my program files, how can i resolve this?
many thankshi,
i gave this a go however it did not resolve the issue. still error when clicking insert. only started happening past few days. cant think of what has happened to make it do it.
any other suggestions?
many thanks -
Its possible to convert Apple script to Java script
Hi,
Please Help me anyone to do that script.
its possible to convert below mentioned Apple script to Java Script.
Thanks in advance.
Help me......!
-yajiv
Code:
tell me to addImageLabels()
on addImageLabels()
tell application "Adobe InDesign CS5"
set numberAdded to 0
activate
set enable redraw of script preferences to true
set currentFonts to (get name of every font)
if currentFonts does not contain fontname then
display dialog "The font \"" & fontname & "\" is not active on your system." buttons {"Continue anyway", "Cancel"} default button 2
end if
tell document 1
-- get a list of unique page IDs in this document
set allpageids to my getPageIds()
repeat with p from 1 to (length of allpageids)
set pgid to item p of allpageids
-- loop through these, getting a list of unique page item IDs to inspect
tell page id pgid
set pageitems to (get id of every page item)
repeat with i from 1 to (length of pageitems)
set pid to item i of pageitems
tell page item id pid
try
-- certain boxes will fail to yield a content type, whatever
if content type is graphic type then
set c to class
set i to id
-- get the name of the link, i.e. the filename, subject to labelFormat (full name, first six chars, etc.)
set gn to my getImageName(pgid, c, i)
if (gn is not "Empty") and (gn is not "") then
set b to visible bounds
set h to (item 3 of b) - (item 1 of b)
set newtop to (item 1 of b) + (h / 2)
set item 1 of b to newtop
set w to (item 4 of b) - (item 2 of b)
if w < minwidth then
set item 4 of b to ((item 4 of b) + 0.2)
set item 2 of b to ((item 2 of b) - 0.2)
end if
set l to (make new text frame at beginning of page id pgid with properties {visible bounds:b, fill color:fillcolor, contents:gn, label:"imagelabel"})
tell l
tell paragraph 1
set justification to center align
try
set applied font to fontname
end try
set point size to fontsize
set fill color to textcolor
end tell
set inset spacing of text frame preferences to ((insetspacing as string) & " in") as string
fit given frame to content
set numberAdded to numberAdded + 1
end tell
end if
end if
end try
end tell
end repeat
end tell
end repeat -- allpageids
end tell -- document 1
display dialog "Added " & numberAdded & " labels." buttons {okButton} default button 1 giving up after 10 with title scriptName
end tell -- InDesign
end addImageLabels
on getPageIds()
tell application "Adobe InDesign CS5"
tell document 1
tell master spread 1
set masterpageids to (get id of every page)
end tell
set docpageids to (get id of every page)
end tell
end tell
return masterpageids & docpageids
end getPageIds
on getImageName(int1, cla1, int2)
tell application "Adobe InDesign CS5"
tell document 1
tell page id int1
if cla1 is rectangle then
set imagename to (name of item link of graphic 1 of rectangle id int2)
else if cla1 is polygon then
set imagename to (name of item link of graphic 1 of polygon id int2)
else
return "Unknown"
end if
try
if (labelformat is "First six characters") then
return (characters 1 thru 6 of imagename) as string
else if (labelformat is "Base name of linked file") then
set op to offset of "." in imagename
return (characters 1 thru (op - 1)) of imagename as string
else
return imagename
end if
on error
return "Empty"
end try
end tell
end tell
end tell
end getImageNameYajiv:
I realize English is probably not your first language, but you are not really making sense. Perhaps you could use more words and write in more detail.
It seems you already have your script in AppleScript. Why do you need to convert it to JavaScript?
It's going to be inconvenient at best and probably not worth anyone's time.
Just use the AppleScript. -
[AS] Versioning to preserve CS3 scripts in CS5
Hi everyone,
I've been reading through the thread about what has changed for scripting InDesign CS5. I have been writing scripts for CS3 for about a year and we are upgrading in the new year. I have the demo of CS5 loaded so I can test how the scripts i've written will or won't run.
Someone indicated in that "what's different" thread that you can "version" the scripts so that they will run in newer versions without having to rewrite the parts of the syntax that have changed.
Can someone elaborate on how to do this with AppleScript?
I put
tell application "Adobe InDesign CS5"
set version of script preferences to "5.0"
at the beginning of the script (and changed all instances of CS3 to CS5 in the script as well) but the script is still not working as with CS3.
Is there something else I need to do to get CS5 to recognize the syntax of CS3 and understand the commands?
ThanksYou will want to set the version back at the end of the script too.
To deal with the syntax issues, you can wrap the relevant code in:
using terms from application "Adobe InDesign CS3"
end using terms from
You can use the "publish terminology" command to make a dummy dictionary-only version of CS3 so you don't need both versions running; how to do it is documented in the InDesign CS5 Scripting Guide.
For scripts you run from the Scripts panel, you don't need to make any changes -- just enclose them in a folder called "Version 5.0 Scripts". -
OpenScript 9.3.1 hangs recording WebHttp type script
Installed OATS 9.31.0036 on Windows 2008 R2 and Trying to record a HTTP Web
type of script for PeopleSoft Transaction and OScript stops recording HTTP
requests.
OpenScript
Version: 9.3.0.0 Production
Build ID: 2.6.0.0272
IE 8.0.76.16385.
I tried the transaction with HTTP watch everything seems to be fine.
Is there any setting in OSCRIPT I may be missing?Windows Server 2008 6.1 , x86
OpenScript 12.2.0.2.79
Internet Explorer 8.0.7600.16385
FireFox 19.0.2
Open Script hangs not recording PeopleSoft transaction.
Open Script type Load Testing/Oracle Peoplesoft
Open Script Preferences>Record HTTP>General>Miscellaneous>Record Mode>HTTP
Open Script Preferences>Record HTTP>General>Miscellaneous>IE Cache>Propmpt to Clear
Open Script Preferences>Record HTTP>Proxy Settings>Chain Proxy>Use browser's proxy
Open Script Preferences>Correlation>HTTP>Web Default (System - Version 12.2.0.1)
Open Script Preferences>Correlation>HTTP>PeopleSoft Version 4
Open Script Preferences>Correlation>Oracle PeopleSoft Load>PeopleSoft (System - Version 12.2.0.1) -
[CS5][AS] Hide progress while running script
Hi,
Can anyone please tell me if it's possible to hide all Indesign operations when running a actionscript.
I would like to speedup a script by hidding all operations (opening files, placing pictures, ect) while running the script.
Many thanks
Kind regards
JohnHi,
You can either make a document without a window
set theDoc to make new document without showing window
or turn off the redraw
set enable redraw of script preferences to false
Gareth
Maybe you are looking for
-
Need help in deleting contacts
Hi All, I recently bought Sony Ericsson Cedar. However, I am unable to delete contacts from contacts-look up while sending a message. can anyone kindly let me know how to delete contacts from contacts look-up section? Solved! Go to Solution.
-
Hold variable values while changing data provider parameters in a template
Dear experts, I have a problem in WAD. I have about 7 reports with 2 Queries each. Because of lower maintenance expenditure i would like to use only one web template. I created a dropdown item with a fixed option list. Every option represents one rep
-
Hi guys, I need some advice! I recently bought a 1TB firewire drive to back up all my big files to. I used it to make a clean copy of my internal HD using super duper, then installed the OS and wiped my internal HD so I could start afresh. Rather unw
-
Personal domain pointing to my site published with iWeb, on MobileMe
Just published my site using iWeb08 onto MobileMe and bought my domain name with GoDaddy. Having troubles getting the domain name www.brendaschroeder.com to point to my site http://web.me.com/brendalynnschroeder/Site/Welcome.html This is the first ti
-
We have droids, iPhone 4s and 5. We moved into a huge community with about 8 subdivisions and houses are 10 years old. I cannot make a call in my home and have to stand in the road to talk to anyone. Zip code 29860 - not rural! I chatted with Ver