Skip to content

Commit

Permalink
fix(jpegmini): the text field in sierra has changed to a combo box
Browse files Browse the repository at this point in the history
closes #129

Debugging with UI Browser has shown me the input for JPEGmini has changed in
OSX 10.12.

The UI Browser report outputs:

```
application "JPEGmini"
    standard window "JPEGmini" (window 1)
        sheet (sheet 1)
            sheet (sheet 1)
                combo box (combo box 1)
```

Added OS X version check to maintain backward compatibility.

My first pass at logical changes were limited because EVAL doesn't seem to be
supported in Apple Script, could be improved with a better comparison for future
versions.

Updated to match code formatting and contribution guide
  • Loading branch information
stefancrain authored and JamieMason committed Feb 5, 2017
1 parent a6e3432 commit 2f711bb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 16 deletions.
30 changes: 22 additions & 8 deletions bin/imageOptimAppleScriptLib
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,28 @@ on runJPEGmini()
(* NAVIGATE TO OUR FOLDER OF IMAGES *)
tell application "System Events"
tell process JPEGMINI_APP_NAME
set value of text field 1 of sheet 1 of sheet 1 of window 1 to DIRECTORY_JPG
repeat
if (value of text field 1 of sheet 1 of sheet 1 of window 1) is not equal to DIRECTORY_JPG then
delay 1
else
exit repeat
end if
end repeat
(* < SIERRA, FILE PATH SELECTOR IS TEXT INPUT *)
if text field 1 of sheet 1 of sheet 1 of window 1 exists then
set value of text field 1 of sheet 1 of sheet 1 of window 1 to DIRECTORY_JPG
repeat
if (value of text field 1 of sheet 1 of sheet 1 of window 1) is not equal to DIRECTORY_JPG then
delay 1
else
exit repeat
end if
end repeat
end if
(* >= SIERRA, FILE PATH SELECTOR IS COMBO BOX *)
if combo box 1 of sheet 1 of sheet 1 of window 1 exists then
set value of combo box 1 of sheet 1 of sheet 1 of window 1 to DIRECTORY_JPG
repeat
if (value of combo box 1 of sheet 1 of sheet 1 of window 1) is not equal to DIRECTORY_JPG then
delay 1
else
exit repeat
end if
end repeat
end if
-- give Finder time to resolve the path
delay 2
keystroke return
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"Martin Schürrer (https://github.com/MSch)",
"Ramiro Araujol (https://github.com/ramiroaraujo)",
"Simen Brekken (https://github.com/sbrekken)",
"Stefan Crain (https://github.com/stefancrain)",
"Tom Chenl (https://github.com/tomchentw)"
],
"devDependencies": {
Expand Down
30 changes: 22 additions & 8 deletions src/imageOptimAppleScriptLib
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,28 @@ on runJPEGmini()
(* NAVIGATE TO OUR FOLDER OF IMAGES *)
tell application "System Events"
tell process JPEGMINI_APP_NAME
set value of text field 1 of sheet 1 of sheet 1 of window 1 to DIRECTORY_JPG
repeat
if (value of text field 1 of sheet 1 of sheet 1 of window 1) is not equal to DIRECTORY_JPG then
delay 1
else
exit repeat
end if
end repeat
(* < SIERRA, FILE PATH SELECTOR IS TEXT INPUT *)
if text field 1 of sheet 1 of sheet 1 of window 1 exists then
set value of text field 1 of sheet 1 of sheet 1 of window 1 to DIRECTORY_JPG
repeat
if (value of text field 1 of sheet 1 of sheet 1 of window 1) is not equal to DIRECTORY_JPG then
delay 1
else
exit repeat
end if
end repeat
end if
(* >= SIERRA, FILE PATH SELECTOR IS COMBO BOX *)
if combo box 1 of sheet 1 of sheet 1 of window 1 exists then
set value of combo box 1 of sheet 1 of sheet 1 of window 1 to DIRECTORY_JPG
repeat
if (value of combo box 1 of sheet 1 of sheet 1 of window 1) is not equal to DIRECTORY_JPG then
delay 1
else
exit repeat
end if
end repeat
end if
-- give Finder time to resolve the path
delay 2
keystroke return
Expand Down

0 comments on commit 2f711bb

Please sign in to comment.