mode 0 menu "Advanced Focus Modes" name "Manual Focus" ########################################################################## ## ## ## MANFOCUS.CSM - Select Manual Focus Distance ## ## Public Domain by Ralf Brown ## ## 815 Copeland Way PMB 26 ## ## Pittsburgh, PA 15232 ## ## USA ## ## ## ## Version 2.0 ## ## Last Edit 14nov99 ## ## ## ## Target Devices: Kodak DC220/DC26x/DC290, Minolta Dimage EX1500 ## ## (developed and tested on a DC260 and DC290) ## ## ## ## Documentation ## ## ============= ## ## ## ## This script lets you set the distance at which the camera is ## ## focused, just like the "Manual Focus" menu item. Unlike the ## ## built-in menu, however, this script gives much finer-grained ## ## control, and automatically adjusts for the difference between ## ## subject distance and required focus setting when using a wide- ## ## angle lens, teleconverter, or macro lens. Note that some WA/tele ## ## lenses do not need any focus adjustment -- check your user manual ## ## for the lens. ## ## ## ## To install, simply copy this file to the SYSTEM folder on your ## ## camera's flash card, using either a card reader, PC-Card slot, or ## ## the Mounter software. After re-inserting the card into the camera ## ## (or turning it off then on again when using the Mounter), you will ## ## see a new item in the "Advanced Focus Modes" menu, in addition to ## ## the customary Multi-Spot, Single-Spot, and Manual Focus. ## ## ## ## By default, this script will ask about your lens every time that ## ## it is run. If you only have one or two lenses, you may want to ## ## adapt this script to your particular attachment lens(es) by making ## ## the following three changes: ## ## 1. change the magnification value in the 'label' line below to ## ## match your lens ## ## 2. change the MAGNIFICATION = line below to set the variable to ## ## be 1000 times the lens' magnification, i.e. for 1.55x use ## ## 1550, for 0.42x use 420, etc. For closeup lenses, use -1000 ## ## times the strength in diopters, i.e. for a +0.5 lens use -500, ## ## for a +17 lens use -17000, etc. ## ## 3. if using more than one lens, and thus more than one version of ## ## this script, change the script's filename. A recommended ## ## naming scheme is MANFOCnn.CSM, where 'nn' is the highest part ## ## of the magnification, i.e. '06' for 0.6x. '14' for 1.4x, etc. ## ## To make the configuration process easier, the most common wide- ## ## and tele-converter magnifications and close-up powers are provided ## ## in the configuration section below; simply remove the ## ## comment-marker hash character from the pair of lines for the ## ## appropriate lens, and add hash marks to the default setting (which ## ## asks for the lens type each time it is run). ## ## ## ########################################################################## declare i:MAGNIFICATION, DEFAULT_MAG, INFINITY declare u:choice, uVarType, mindist, fdst, meters, tens, cm declare i:status, iMin, iMax, iDefault declare b:verbose verbose = 0 # verbose = 1 ############################################################### ### Configuration: Select *one* of the sets of lines below ### ### by uncommenting it (removing the leading hash marks) ### ############################################################### ### the default: ask user for lens type ### label "Manual Focus Script" MAGNIFICATION = 0 ### Wide Angle: 0.42x ### # label "Manual Focus (0.42x)" # MAGNIFICATION = 420 ### Wide Angle: 0.5x ### # label "Manual Focus (0.5x)" # MAGNIFICATION = 500 ### Wide Angle: 0.65x ### # label "Manual Focus (0.65x)" # MAGNIFICATION = 650 ### Wide Angle: 0.75x ### # label "Manual Focus (0.75x)" # MAGNIFICATION = 750 ### Lenses for which no focus adjustment is needed ### # label "Manual Focus (no-adj)" # MAGNIFICATION = 1000 ### Teleconverter: 1.2x ### # label "Manual Focus (1.2x)" # MAGNIFICATION = 1200 ### Teleconverter: 1.4x ### # label "Manual Focus (1.4x)" # MAGNIFICATION = 1400 ### Teleconverter: 1.5x ### # label "Manual Focus (1.5x)" # MAGNIFICATION = 1500 ### Teleconverter: 1.7x ### # label "Manual Focus (1.7x)" # MAGNIFICATION = 1700 ### Teleconverter: 1.8x ### # label "Manual Focus (1.8x)" # MAGNIFICATION = 1800 ### Teleconverter: 2.0x ### # label "Manual Focus (2.0x)" # MAGNIFICATION = 2000 ### Teleconverter: 3.0x ### # label "Manual Focus (3.0x)" # MAGNIFICATION = 3000 ### Teleconverter: 5.0x ### # label "Manual Focus (5.0x)" # MAGNIFICATION = 5000 ### Monocular: 8.0x ### # label "Manual Focus (8.0x)" # MAGNIFICATION = 8000 ### Monocular: 10.0x ### # label "Manual Focus (10.0x)" # MAGNIFICATION = 10000 ### Close-Up Lens: +0.5 diopter ### # label "Manual Focus (+0.5)" # MAGNIFICATION = -0500 ### Close-Up Lens: +1.0 diopter ### # label "Manual Focus (+1)" # MAGNIFICATION = -1000 ### Close-Up Lens: +2.0 diopter ### # label "Manual Focus (+2)" # MAGNIFICATION = -2000 ### Close-Up Lens: +3.0 diopter ### # label "Manual Focus (+3)" # MAGNIFICATION = -3000 ### Close-Up Lens: +4.0 diopter ### # label "Manual Focus (+4)" # MAGNIFICATION = -4000 ### Close-Up Lens: +5.0 diopter ### # label "Manual Focus (+5)" # MAGNIFICATION = -5000 ### Close-Up Lens: +6.0 diopter ### # label "Manual Focus (+6)" # MAGNIFICATION = -6000 ### Close-Up Lens: +7.0 diopter ### # label "Manual Focus (+7)" # MAGNIFICATION = -7000 ### Close-Up Lens: +10.0 diopter ### # label "Manual Focus (+10)" # MAGNIFICATION = -10000 ### Close-Up Lens: +17.0 diopter ### # label "Manual Focus (+17)" # MAGNIFICATION = -17000 ############################################################### ### End of Configuration Options ### ############################################################### DEFAULT_MAG = 1000 INFINITY = 65535 # # start by checking whether we are even able to set the focus manually # status = 0 status = GetCapabilityType("fdst",uVarType) if status != 0 Alert("Manual focus is not supported ","by this camera.") exitscript end if uVarType != 2 Alert("The focus distance can not be ","set to arbitrary values by ","this camera.") exitscript end # # OK, camera can focus manually, so get the minimum focusing distance # (which will let us know what settings to put in the menu) # status = 0 status = GetCapabilitiesRange("fdst",iMin,iMax,iDefault) if status != 0 Alert("Error retrieving minimum ","focus distance!") exitscript end # # if the lens type hasn't been specified, ask the user # if MAGNIFICATION == 0 lens_loop: SetOption(1,"Wide-Angle Lens") SetOption(2,"Teleconverter") SetOption(3,"No adjustment needed") SetOption(4,"Close-Up (Macro) Lens") SetOption(0,"-- Select Lens Type --") GetOption(choice) if choice == 0 goto lens_loop end if choice == 1 SetOption(420,"0.42x wide-angle") SetOption(500,"0.5x wide-angle") SetOption(650,"0.65x wide-angle") SetOption(750,"0.75x wide-angle") SetOption(800,"0.8x wide-angle") GetOption(choice) if choice != 0 MAGNIFICATION = choice end end if choice == 2 SetOption(1200,"1.2x tele") SetOption(1400,"1.4x tele") SetOption(1500,"1.5x tele") SetOption(1700,"1.7x tele") SetOption(1800,"1.8x tele") SetOption(2000,"2.0x tele") SetOption(3000,"3.0x tele") SetOption(5000,"5.0x tele") SetOption(8000,"8x monocular") SetOption(10000,"10x monocular") GetOption(choice) if choice != 0 MAGNIFICATION = choice end end if choice == 4 SetOption( 500,"+0.5 close-up") SetOption(1000,"+1 close-up") SetOption(2000,"+2 close-up") SetOption(3000,"+3 close-up") SetOption(4000,"+4 close-up") SetOption(5000,"+5 close-up") SetOption(6000,"+6 close-up") SetOption(7000,"+7 macro") SetOption(10000,"+10 macro") SetOption(17000,"+17 macro") GetOption(choice) if choice != 0 MAGNIFICATION = -1 * choice goto macro_focus end end if MAGNIFICATION == 0 MAGNIFICATION = DEFAULT_MAG end end # # now that we know both the minimum focus distance and the adjustment # factor, compute the minimum subject distance # mindist = iMin * MAGNIFICATION + MAGNIFICATION/2 mindist = mindist / DEFAULT_MAG fdst = 0 # # The main focusing menu. Since there are lots and lots of settings, break # them into five ranges, with a submenu for each range. The ranges are # not in strictly increasing order to allow for quick access to the Infinity # setting # SetOption(1,"Over 50 meters (165 feet)") if mindist <= 180 SetOption(2,"Less than 2 meters (7 feet)") end SetOption(3,"2 - 5 meters (7 - 16 feet)") SetOption(4,"6 - 15 meters (19 - 50 feet)") SetOption(5,"16 - 50 meters (60 - 165 feet)") GetOption(choice) if choice == 1 SetOption(655360,"Infinity") SetOption(6000,"60m (200 feet)") SetOption(7000,"70m (230 feet)") SetOption(8000,"80m (260 feet)") SetOption(10000,"100m (330 feet)") SetOption(15000,"150m (490 feet)") SetOption(20000,"200m (660 feet)") SetOption(25000,"250m (820 feet)") SetOption(50000,"500m (1640 feet)") GetOption(fdst) end if choice == 2 # # the close-up menu -- only present the choices that are far enough # away that we can actually focus on them # if mindist <= 50 SetOption(1,"Macro") end if mindist <= 60 SetOption(60,"60cm (22in)") end if mindist <= 70 SetOption(70,"70cm (27in)") end if mindist <= 80 SetOption(80,"80cm (32in)") end if mindist <= 90 SetOption(90,"90cm (36in)") end if mindist <= 100 SetOption(100,"1m (40in)") end if mindist <= 120 SetOption(120,"1.2m (47in)") end if mindist <= 150 SetOption(150,"1.5m (59in)") end if mindist <= 180 SetOption(180,"1.8m (70in)") end GetOption(fdst) if fdst == 1 # # present the macro mode menu # if mindist <= 10 SetOption(10,"10cm (4in)") end if mindist <= 12 SetOption(12,"12cm (5in)") end if mindist <= 15 SetOption(15,"15cm (6in)") end if mindist <= 20 SetOption(20,"20cm (8in)") end if mindist <= 30 SetOption(30,"30cm (12in)") end if mindist <= 33 SetOption(33,"33cm (13in)") end if mindist <= 38 SetOption(38,"38cm (15in)") end if mindist <= 50 SetOption(50,"50cm (18in)") end GetOption(fdst) end end if choice == 3 if mindist <= 200 SetOption(200,"2.0m (7 feet)") end if mindist <= 250 SetOption(250,"2.5m (8 feet)") end SetOption(300,"3.0m (10 feet)") SetOption(350,"3.5m (11 feet)") SetOption(400,"4.0m (13 feet)") SetOption(450,"4.5m (15 feet)") SetOption(500,"5m (16 feet)") GetOption(fdst) end if choice == 4 SetOption(600,"6m (20 feet)") SetOption(700,"7m (23 feet)") SetOption(800,"8m (26 feet)") SetOption(900,"9m (30 feet)") SetOption(1000,"10m (33 feet)") SetOption(1200,"12m (39 feet)") SetOption(1400,"14m (46 feet)") SetOption(1500,"15m (49 feet)") GetOption(fdst) end if choice == 5 SetOption(1800,"18m (59 feet)") SetOption(2000,"20m (66 feet)") SetOption(2500,"25m (82 feet)") SetOption(3000,"30m (98 feet)") SetOption(3500,"35m (115 feet)") SetOption(4000,"40m (130 feet)") SetOption(4500,"45m (150 feet)") SetOption(5000,"50m (165 feet)") GetOption(fdst) end set_focus: if fdst != 0 # # switch to manual focusing # status = 0 status = SetCameraState("fmod",3) if status != 0 Alert("Unable to switch to ","manual-focus mode") end # # and compute the true focus distance for the given subject distance # and lens # fdst = DEFAULT_MAG * fdst + MAGNIFICATION / 2 fdst = fdst / MAGNIFICATION # # since a distance of 65535cm means Infinity, avoid confusing the # camera with distances greater than Infinity.... # if fdst > INFINITY fdst = INFINITY end # # Finally! Set the focus distance # status = 0 status = SetCameraState("fdst",fdst) meters = fdst / 100 cm = fdst - 100 * meters tens = cm / 10 cm = cm - 10 * tens if status == 0 if verbose if fdst == INFINITY Alert("Focus set to Infinity") end if fdst != INFINITY Alert("Focus set to ",fdst,".",tens,cm,"m") end end end if status != 0 if fdst == INFINITY Alert("Unable to set focus to Infinity") end if fdst != INFINITY Alert("Unable to set focus to ",fdst,".",tens,cm,"m") end end end goto done ######################################################################### macro_focus: # for diopter D and focus F, subject distance = F / (1+D*F), hence # we want to set F = distance + distance * D * F if MAGNIFICATION == -500 SetOption(65535,"2m (7 feet)") SetOption(100,"67cm (26in)") SetOption(50,"40cm (16in)") goto set_macro end if MAGNIFICATION == -1000 SetOption(65535,"1m (3.3 feet)") SetOption(1000,"91cm (3 feet)") SetOption(500,"83cm (32.7in)") SetOption(250,"71cm (28in)") SetOption(200,"67cm (26.4in)") SetOption(150,"60cm (23.6in)") SetOption(100,"50cm (19in)") SetOption(75,"43cm (16.9in)") SetOption(65,"39cm (15.4in)") SetOption(50,"33cm (13in)") goto set_macro end if MAGNIFICATION == -2000 SetOption(65535,"50cm (19.7in)") SetOption(1000,"47cm (18.5in)") SetOption(500,"45cm (17.7in)") SetOption(250,"42cm (16.5in)") SetOption(200,"40cm (15.75in)") SetOption(150,"37.5cm (14.75in)") SetOption(100,"33cm (13in)") SetOption(75,"30cm (11.8in)") SetOption(50,"25cm (10in)") goto set_macro end if MAGNIFICATION == -3000 SetOption(65535,"33cm (13in)") SetOption(500,"31.25cm (12.5in)") SetOption(300,"30cm (12in)") SetOption(160,"27.5cm (11in)") SetOption(100,"25cm (10in)") SetOption(75,"23cm (9in)") SetOption(50,"20cm (8in)") goto set_macro end if MAGNIFICATION == -4000 SetOption(65535,"25cm (10in)") SetOption(600,"24cm (9.4in)") SetOption(250,"22.7cm (8.9in)") SetOption(100,"20cm (8in)") SetOption(75,"18.75cm (7.5in)") SetOption(50,"16cm (6.5in)") goto set_macro end if MAGNIFICATION == -5000 SetOption(65535,"20cm (8in)") SetOption(250,"18.5cm (7.25in)") SetOption(100,"16cm (6.5in)") SetOption(60,"15cm (6in)") SetOption(50,"14cm (5.5in)") goto set_macro end if MAGNIFICATION == -6000 SetOption(65535,"16cm (6.5in)") SetOption(200,"15.3cm (6.1in)") SetOption(150,"15cm (6in)") SetOption(100,"14cm (5.5in)") SetOption(70,"13.4cm (5.25in)") SetOption(50,"12.5cm (5in)") goto set_macro end if MAGNIFICATION == -7000 SetOption(65535,"14cm (5.5in)") SetOption(200,"13.3cm (5.25in)") SetOption(100,"12.5cm (5in)") SetOption(70,"11.8cm (4.65in)") SetOption(50,"11cm (4.4in)") goto set_macro end if MAGNIFICATION == -10000 SetOption(65535,"10cm (4in)") SetOption(200,"9.5cm (3.75in)") SetOption(100,"9cm (3.5in)") SetOption(50,"8.3cm (3.25in)") goto set_macro end if MAGNIFICATION == -17000 SetOption(65535,"6cm (2.5in)") SetOption(200,"5.7cm (2.3in)") SetOption(100,"5.5cm (2.2in)") SetOption(50,"5.25cm (2.1in)") goto set_macro end Alert("Sorry, that close-up lens is not supported!") goto done set_macro: GetOption(choice) if choice != 0 fdst = choice goto set_focus end Alert("script error -- sorry...") done: Wait(1) exitscript ######################################################################### # End of File # #########################################################################