AppleScript can be really dirty sometimes

By neonblue2
Easy to understand but hard to keep clean. For example:
set enabled of text field "dimenHeight_Textbox" of view "dimenCustom_Inset" of view "dimenUI_Inset" of view "windowVideo_Inset" of tab view "windowMain_Inset" of window "windowMain" to false
This one line disables one text box in the interface. I don't know how to do the same in Cocoa but I know it's easier than this.

I do like this function I wrote though. I have yet to see someone do the same in AppleScript.

on windowConvert_ProgressBarStopFunction()
set a to do shell script "ps ux | awk '/mencoder/ && !/awk/ {print $2}' &"
set b to a

repeat
if b is equal to a then
set a to do shell script "ps ux | awk '/mencoder/ && !/awk/ {print $2}' &"
else
stop progress indicator "windowConvert_ProgressBar" of window "windowMain"
exit repeat
end if
end repeat
end windowConvert_ProgressBarStopFunction

It stops the progress bar when MEncoder stops encoding. Since AppleScript is single-threaded there's no easy why to run a shell script and show a progress bar at the same time.

-----------

0 comments so far.

Something to say?