--- In [email protected], sgp <[EMAIL PROTECTED]> wrote:
>
> swzoh wrote:
> 
> > I thought I might have to provide the Rectangular dimension and the
> > Zoom factor as variables, but, then they should be constantly
> > referenced inside the For Loop, which seemed not good to me.
> 
> Yes, I thought that's why you didn't use variables. I'd do the same
in this case.
> 
> A possible work-around could be to use regexps to replace
"constants" on the fly, something like
> 
> 1) first, in your script replace all numeric constants with symbolic
"constants", for instance
> 
> hWnd.size(2*200,2*200)
> becomes
> hWnd.size(2*!XWIDTH!,2*!YWIDTH!*)
> 
> 2) then place this code at the very top of your script file
> 
> args XWIDTH YWIDTH
> if(not arg(0))do ;; default values
>   XWIDTH=80
>   YWIDTH=80
>   ...
> endif
> 
> local scr=scriptfolder++?"\"++scriptname++".powerpro"
> local s = file.readall(scr)
> s[?"(#g)!XWIDTH!"]=XWIDTH
> s[?"(#g)!YWIDTH!"]=YWIDTH
> ;; replace all other args in a similar fashion
> ;; ...
> 
> file.writeall(scr++".tmp")
> quit( call(scr++"[EMAIL PROTECTED]") )
> @ main
> ;; the rest of your script follows below
> 
> 3) then call your script as
> .ColorZoomer(200,200,...)
> or
> .ColorZoomer for default values
>

OK, I updated it using (local) variables nRect and nZoom, and
explicitly set them to 80/2 and 5. You may freely tailor it to your taste.

Actually this form has one merit to my taste: runtime change of the
zoom factor, by defining it as a global and using a hotkey or an event.

Sean






Attention: PowerPro's Web site has moved: http://www.ppro.org 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/power-pro/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to