For years I've been using set_prop to configure the aspect ratio in my scripts like this:
--SX60 Props 304 & 399 Aspect Ratio (0=4:3, 1=16:9, 2=3:2, 3=1:1, 4=4:5)
set_prop(require("propcase").ASPECT_RATIO, 0)Unfortunately the camera's UI does not reflect this change, so the viewfinder crops the display differently to the images captured. Worse, switching to Play and back to Record loses the change completely. Looking for a better way I tried your excellent CmpUIP feature, which uncovered this UIProp:
--SX60 UIProp 26 Aspect Ratio (0=16:9, 1=3:2, 2=4:3, 3=1:1, 4=4:5)Interestingly those values do not match the Prop values but they do align with their order in the Canon menu. So I thought great, I'll just set that in my script:
set_uiprop(26, 2)But the function does not exist! I couldn't understand why the Debug menu let me discover UIProps that I can't get or set. Searching for this obvious function name lead me to this thread, where after reading all 5 pages and digging through several more wiki articles, I finally got it working like this:
--register PTM_* functions
call_event_proc("UI.Create")
--set UIProp 26 to 2
call_event_proc("PTM_SetCurrentItem", 0x8000 + 26, 2)Upon running that code, the camera's UI instantly updates to 4:3 and sets Props 304 & 399 to 0. Better yet, it survives switching modes and even restarting the camera, which I guess is the reason you guys are scared to implement it. To that end, I tried passing an invalid value of 5 and the camera crashed immediately. It came back up fine though, so I believe such fears are exaggerated.
About abstraction: due to differences between camera generations, these properties should probably be manipulated by separate script functions. For camera-specific use, we could introduce generic functions like set_uiprop() and get_uiprop().
So my question is, can you guys please introduce the scripting functions
get_uiprop and
set_uiprop that
srsa_4c suggested over 1 year and 4 months ago? You've already done all the hard work, it's time to make it official. This technology will eliminate the need for all sorts of slow and unreliable button-pushing scripts, as well as allowing scripts to read UIProps that do not have a corresponding Prop (eg AF Frame Size)