> I can't understand why you would want those changes, which
> make my suggested script worse in at least three ways.
What I was going for was if you cancel the inputdialog (clicked the script
by accident) a cancel would not do anything. (and I thought it was a quick
tweak of the script - silly david, scripts are for kids =D )
You were right, the pproflag was redundant (I should know by now that I
can't tweak without testing ;) ). All it needed was an else so that an else
would abort processing. You are right about it moving the file copy no
matter what if() results were, so we would need to move the copy command to
the successful run of the if statement area to avoid unnecessary file copies
on script aborting.
Now, the only other thing that it looks like you want to be able to do is to
maintain default values for the script with a 1-key acknowledgment. So let's
stuff the variables before displaying the inputdialog so you can just hit
enter to maintain original settings.
So, this hopefully will be my final tweaking of your script:
;;-------This is customfolder.powerpro------
local targetfolder = arg(1)
local sourceini = "c:\store\desktop.ini"
local targetini = targetfolder ++ "\desktop.ini"
;; Don't error if source ini values/file doesn't exist
ini.error_dialog_off()
;; Get initial ini values to prefill inputdialog()
local iconfilepath = ini.get(sourceini, ".ShellClassInfo", "IconFile")
local iconindex = ini.get(sourceini, ".ShellClassInfo", "IconIndex")
local infotip = ini.get(sourceini, ".ShellClassInfo", "Infotip")
local confirmfileop = ini.get(sourceini, ".ShellClassInfo", "ConfirmFileOp")
local nosharing = ini.get(sourceini, ".ShellClassInfo", "NoSharing")
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
;; that was one long line of course
;; Ok was clicked, so let's copy file and write the values we want.
file.copy(sourceini, targetfolder)
wait 1
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)
else
;; Cancel was clicked on the inputdialog, abort script.
Quit
endif
;;-----------------------------------
The only thing not working with this script is the:
file.copy(sourceini, targetfolder)
...which was your previous syntax, with a variable instead of static entry
for source file. See other E-mail, I think (my?) file plugin is somehow
broken.
And the final result is: You can accept default values of desktop.ini with a
single key (enter or clicking ok). You can completely abort script
processing if you accidentally ran this script (esc or click cancel) and it
pre-fills the input dialog so you can see examples of what text you might
want (default values) in the inputdialog().
Whew =)
David Troesch | Atlanta, GA | ICQ# 2333123
America: Land of the free, home of the mega-corps. http://tinyurl.com/4weom
Funstuff: and your point is...?
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/