David wrote:

d> I've modified the script so that if you hit cancel (with the latest beta
d> 4.2.09 or later) clicking cancel will cancel the script entirely. Probably
d> need to test the syntax, just in case I goofed the pproflag(0) test :)

I can't understand why you would want those changes,
which make my suggested script worse in at least three ways.

For one thing, adding the pproflag(0) seems to be redundant.
As Help says about inputdialog:
"Result is 1 unless cancel is pressed in which case it is 0"
The Result [1 or 0] was already being tested by my putting
the inputdialog call inside an if()do.

The unnecessary double testing is not as important as the
functional change your script would cause.
On Cancel your script stops only half of the customising process.
It would be better to cancel all or none of the customising.

The way I designed it, if you cancel the input dialog
you will still have a customised folder, using whichever custom
folder icon you use most often, without bothering to fill in the
dialog. That's meant to be a time saving convenience.

The way you have modified it, if the user cancels the input
they will end up with their usual desktop.ini copied into the
target folder but the folder does not have its System attribute set.

If you want cancelling the dialog to not change the folder,
then not only the ini.set() commands but also the Copy command
should be conditional. So it should be moved in the script,
like this:

local targetfolder = arg(1)
local targetini = targetfolder ++ "\desktop.ini"

if(inputdialog("iconfilepath=Icon file path,iconindex=Icon index number,
infotip=Infotip text,confirmfileop=Confirm file operations 0 or 1,
nosharing=No sharing 0 or 1","Custom folder settings"))do

file.copy("c:\store\desktop.ini",targetfolder)

ini.set(targetini, ".ShellClassInfo", "IconFile", iconfilepath)
ini.set(targetini, ".ShellClassInfo", "IconIndex", iconindex)
ini.set(targetini, ".ShellClassInfo", "Infotip", infotip)
ini.set(targetini, ".ShellClassInfo", "ConfirmFileOp", confirmfileop)
ini.set(targetini, ".ShellClassInfo", "NoSharing", nosharing)

do("attrib", "+s " ++ targetfolder)

endif
;; ------------------ end of script --------

Also, your structure like this:

if(condition)do
command A
else
quit
endif
command B

would be neater and easier to understand like this:

If(condition)do
command A
command B
endif



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