After some more applescripting, i got to the following script... Regards, wimdmr
--scan with sane 3.3 by wimdmr
--declaring the variables
global theWay, theWidth, theHeight, theFormat, theRes, theMode, theDepth, theWidthList, theHeightList, theResList, theModeList, theDepthList, fromTop, fromLeft, theFile, theFileRaw, theScript
set theWayList to {"Select settings manually", "Document A4", "Document A3", "Document A3 landscape", "Photo A4", "Photo A3", "Photo A3 landscape"}
set theWidthList to {50, 100, 148, 210}
set theHeightList to {50, 100, 148, 210, 297}
set theFormatList to {"tiff", "pnm"}
set theResList to {150, 300, 600, 1200}
set theModeList to {"Color", "Gray", "Lineart"}
set theDepthList to {8, 16}
set fromTop to 0
set fromLeft to 0
set theFormat to "tiff"
set ajaj to "User cancelled."
--choosing options with dialogs
set theWay to choose from list theWayList with prompt "Select Scan options" default items {"Document A4"} OK button name "Continue"
if theWay as string is equal to "Select settings manually" then
try
set theWidth to choose from listtheWidthListwith prompt "This wide (mm):" default items (last item of theWidthList) OK button name "OK"
checkInput(theWidth)
set theHeight to choose from listtheHeightListwith prompt "This high (mm):" default items (last item of theHeightList) OK button name "OK"
checkInput(theHeight)
set theFormat to choose from listtheFormatListwith prompt "choose format" default items (first item of theFormatList) OK button name "OK"
checkInput(theFormat)
set theRes to choose from list theResList with prompt "with scan resolution (dpi):" default items (first item of theResList) OK button name "OK"
checkInput(theRes)
set theMode to choose from listtheModeListwith prompt "Choose mode" default items (second item of theModeList) OK button name "OK"
checkInput(theMode)
if theMode as string is equal to "Lineart" then
set theDepth to 0 -- no depth when lineart selected
else
set theDepth to choose from list theDepthList with prompt "with depth (bits):" default items (first item of theDepthList) OK button name "OK"
checkInput(theDepth)
end if
setFileAndScriptAndRun()
on error optionsError
display alert optionsError message "You escaped during setting the options." & return & "Aborting scan…" & return & "Source: optionsError"
end try
else if theWay as string is equal to "Document A4" then
setOptions(210, 297, 150, "Gray", 16)
else if theWay as string is equal to "Document A3" then
setOptions(148, 210, 150, "Gray", 16)
else if theWay as string is equal to "Document A3 landscape" then
setOptions(210, 148, 150, "Gray", 16)
else if theWay as string is equal to "Photo A4" then
setOptions(210, 297, 600, "Color", 16)
else if theWay as string is equal to "Photo A3" then
setOptions(148, 210, 600, "Color", 16)
else if theWay as string is equal to "Photo A3 landscape" then
setOptions(210, 148, 600, "Color", 16)
else --
try
checkInput(theWay)
on error theWayFalse
display alert theWayFalse message "No scan selected." & return & "Now quitting…" & return & "Source: theWayFalse" buttons {"I Know"}
end try
end if
--handlers
to setOptions(aWidth, aHeight, aRes, aMode, aDepth)
set theWidth to aWidth
set theHeight to aHeight
set theRes to aRes
set theMode to aMode
set theDepth to aDepth
setFileAndScriptAndRun()
end setOptions
to checkInput(inputValue)
if inputValue is false then
error number -128 --user cancelled.
end if
end checkInput
to setFileAndScriptAndRun()
try
set theFileRaw to (choose file name with prompt ("Select location and file name.") default name "Scanimage-1" default location (path to downloads folder))
set theFile to quoted form of POSIX path of theFileRaw & "." & theFormat
if theMode as string is equal to "Lineart" then
set theScript to "/usr/local/bin/scanimage -t " & fromTop & " -l " & fromLeft & " -x " & theWidth & " -y " & theHeight & " --format " & theFormat & " --mode " & theMode & " --resolution " & theRes & " > " & theFile -- no depth when lineart selected
else
set theScript to "/usr/local/bin/scanimage -t " & fromTop & " -l " & fromLeft & " -x " & theWidth & " -y " & theHeight & " --format " & theFormat & " --mode " & theMode & " --resolution " & theRes & " --depth " & theDepth & " > " & theFile
end if
executeTask("sim")
on error fileError
display alert fileError message "No file selected." & return & "Source: fileError."
end try
end setFileAndScriptAndRun
to executeTask(how) --sim or run
if how as string is equal to "sim" then
theScript
else if how as string is equal to "run" then
do shell scripttheScript
tell application "Finder"
open (theFileRaw as string) & "." & theFormat as string
end tell
end if
end executeTask