Hi, totally new to Apple Script and it is not as easy to do some things as I hoped, but this site is proving to be a good learning environment.
I want to be able to load Image Capture on a machine and automatically share the scanner that is attached.
I have got a script to load Image Capture and by using the Keystrokes command, load the preference pane.
In the example I looked at, it then pressed the Alt + Number to change the tabs, but this does not do anything in Image Capture and searching for tabs doesn’t really return any options.
anyone tell me how I can take the preference screen off from “General” and onto “Sharing”.
I guess I’ll be back with more afterwards, but that may help me start off.
Hi. I think I’m going to feel new to AppleScript for quite a while.
You can work this into your script:
tell application "System Events"
tell process "Image Capture"
tell window 1
tell radio button "Sharing" of tab group 1
click
end tell
end tell
end tell
end tell
which can be shortened to:
tell application "System Events" to tell process "Image Capture" to click radio button "Sharing" of tab group 1 of window 1
If you lock on an element, a second window opens with additional information.
If there are few UI elements, and especially if only one, I use numbers because there’s less typing. If I’m unsure of a number, I use the name.
Unfortunately, sometimes names and numbers aren’t what they appear to be so guessing or repeating through the elements (see Jacques example here - http://bbs.applescript.net/viewtopic.php?id=17460) becomes necessary.
The inspector’s main window gives this information on the first device’s checkbox:
tell application "System Events" to tell process "Image Capture" to tell checkbox 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 to perform action "AXPress"
Many thanks for you help and pointers with this. With the uiinspector and a few other selected searches I got the script to do what I want. Only selects the first device, but hey, that will do. I may modify it to disable other features at some stage.
set DEPT to "<some department / description>"
tell application "Image Capture"
activate
tell application "System Events"
set foremost to true
keystroke "," using command down
tell application "System Events"
tell process "Image Capture"
if value of checkbox "Share my devices" of tab group 1 of window 1 = 0 then
tell checkbox "Share my devices" of tab group 1 of window 1 to perform action "AXPress"
end if
set value of text field 1 of tab group 1 of window 1 to DEPT
if value of checkbox 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 = 0 then
tell checkbox 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 to perform action "AXPress"
end if
tell button "OK" of window 1 to perform action "AXPress"
end tell
end tell
end tell
end tell
tell application "System Events" to if "Image Capture" is in name of processes then tell application "Image Capture" to quit