Oh dear, there's a problem with feeding the correct syntax
to the final Do() command.
It wants a comma between the app.exe and any following parameters:
Do("c:\windows\notepad.exe", "C:\test1\xxshorthelp.txt")
;; rather than:
Do("c:\windows\notepad.exe" "C:\test1\xxshorthelp.txt")
So it will need some string manipulation, which can find the first
filepath in zCommand and add a comma after it.
That might be difficult because
[a] In the registry, the leading exepath is sometimes in quotes,
sometimes not.
[b] it might have extra command line switches such as /p, which do()
will want to be after the comma.
For now, I can't think how to modify zCommand to add that comma
in the right place to suit the do() function.
Sorry, I only tested my script in its debug mode which has a third parameter,
if arg(3) is not zero or "" it debugs instead of executing the command:
[EMAIL PROTECTED]("c:\folder\file.txt","Edit",1)
;; runs it in test mode
;;------------------ misc.powerpro -----------------
@doverb
zInputFilePath = arg(1)
If(not validpath(zInputFilePath))do
win.message(zInputFilePath ++ ?" is not a valid file path", "Verb doing
script")
quit
endif
zVerb = arg(2)
zFileTypeKey = reg.get_value(?"HKEY_CLASSES_ROOT\." ++
file.type(zInputFilePath) ++ ?"\")
zAllVerbs = reg.enum_keys(?"HKEY_CLASSES_ROOT\" ++ zFileTypeKey ++ ?"\shell\")
If(not index(zAllVerbs,zVerb))do
win.message(?"No such verb " ++ zVerb ++ " for *." ++
file.type(zInputFilePath), "Verb doing script")
quit
endif
zCommand = reg.get_value(?"HKEY_CLASSES_ROOT\" ++ zFileTypeKey ++ ?"\shell\" ++
zVerb ++ ?"\command\")
zCommand = replacechars(zCommand, ?#"%1"#, ?#"# ++ zInputFilePath ++ ?#"#)
zCommand = replacechars(zCommand, ?#%1#, ?#"# ++ zInputFilePath ++ ?#"#)
;; [I removed the unnecessary IFs around those two lines]
If(arg(3)do
debug
win.debug("Verb doing script, just testing")
win.debug("Verb = " ++ zVerb)
win.debug(zCommand)
debug
else
Do(zCommand)
endif
quit
> ;;-----------------------------------------------------------
The commands always look ok in debug,
but the do() function doesn't like them without an added comma.
An easy way out is
Do("cmd",?"/c " ++ zCommand)
which works because the zCommand which my script creates contains
something which is acceptable almost everywhere except in do()
for example it would work if the contents of zCommand were pasted
into PP's tiny run box or into a script.
Time for a nap.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Great things are happening at Yahoo! Groups. See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/JV_rlB/TM
--------------------------------------------------------------------~->
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/