I got an error:
Bad expression: expecting value or variable at "> args= win.debug(date++time,scriptname++"@X: path=<"++s++"> args= Error occurred near line 186 which contained: win.debug(date++time,scriptname++"@X: path=<"++s++"> args= Press Cancel to end all running scripts. --- In [email protected], sgp acs322000 <[EMAIL PROTECTED]> wrote: > Here's a slightly revised version: > - expanded debug line and added how to comment it out > - made PATH escape-character independent > > Be sure to read all comments and examples. > Make sure to read and apply sections REQUIRED PLUGINS, and > CONFIGURATION. > > Installation: > 1. Cut & paste into file runit.powerpro (or whatever name you like) in > your powerpro scripts folder > All lines should start with a $ character. Join long lines. Remove all > $ characters. Done. > > Run as [EMAIL PROTECTED](...) - See EXAMPLES section > > > $;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; > ;;;;;; > $; NAME: X > $; > $; PURPOSE: > $; run a program > $; > $; HISTORY: ! major improvement > $; + added feature > $; * improved/changed feature > $; - bug fix > $; 20050525 Yahoo group posting > $; * expanded debug line and added how to comment it out > $; * made PATH escape-character independent > $; 20050522 Yahoo group posting, base version > $; > $; ARGUMENTS: (*=optional) > $; 1 title - show program title as On Screen Display (WinNT derivatives > only) > $; use "" for no OSD > $; 2 delay - OSD delay in ms > $; use <0 to hide program window (deprecated, see arg(7) below) > $; [EMAIL PROTECTED] blocks waiting delay ms for program to complete > $; and returns the program exit code, or 9999999 if delay exceeded > $; use 0 for wait until program exits > $; use 1 for (practically) no wait > $; 3 window caption - if window caption matches an existing window then > $; don't run the program (single instance); special cases: > $; "*" -> allow multiple instances (don't check caption) > $; "" -> generate caption as "="++file.name(arg(4)) > $; 4 program path (normally passed with escape protection as in > ?"path") > $; - absolute pathname OR > $; - relative pathname - will search for run_path in local PATH > variable > $; (initialized it below) > $; - if %envvar% included it will be expanded > $; 5* program arguments, see CAVEAT about arg(7) comspec > $; 6* initial folder > $; if "" then [EMAIL PROTECTED] will cd to the folder where arg(4) resides > $; 7* string of options, including: > $; comspec - use ComSpec envvar to start fully-resolved arg(4) with > $; /c "^"arg(4)^" arg(5)" > $; CAVEAT: since cmd.exe wants a quoted string after /c > $; escape doublt quotes in arg(5) with ^" - see examples below > $; min - minimize program window > $; max - maximize program window > $; normal - show program window (default) > $; hide OR inv - hide program window > $; > $; EXAMPLES: > $; ;basic syntax with OSD and reuse notepad if already running > $; [EMAIL PROTECTED]("Editor","1000", "=notepad",?"% windir%/system32/notepad.exe") > $; ; - OR - > $; setstring x %windir/system32/notepad.exe > $; [EMAIL PROTECTED]("Editor","1000", "=notepad", x) > $; > $; ;start a new maximized notepad (set %windir% in local PATH variable) > $; [EMAIL PROTECTED]("",1, "*",?"notepad.exe","","","max") > $; > $; ;relative path, multiple instance: > $; [EMAIL PROTECTED]("paper", 500, "*", "IrfanView\i_view32.exe", ?_"_++doc++? _"_) > $; > $; ;use system shell to run the document, i.e.: a pdf file > $; [EMAIL PROTECTED]("paper", -500, "*", ?"%COMSPEC%", " /c > "++?_"_++doc++?_"_) > $; > $; ;sample idiom for Context command list entry: > $; [EMAIL PROTECTED]("",1,"*","WinRar/WinRar.exe",??"!"?,file.folder(_file_)) > $; > $; ;fallback to running p2 if single instance of p1 can't run > $; ; (see also RETURN VALUE): > $; exec onerror clear > $; if ( 0 >= [EMAIL PROTECTED]("",1,caption,"path/p1.exe",args) || "" != _LastError_ ) > $; [EMAIL PROTECTED]("",1,caption2,"path2/p2.exe",args2) > $; > $; ;run a a builtin 4nt command and exit (assumes ComSpec=cmd.exe) > $; [EMAIL PROTECTED]("",0,"*",?"4nt\4nt.exe", "beep 2000 1%=&exit","","inv comspec") > $; > $; ;resolve command-line program path then run it invisibly quoting its > $; ;arguments and waiting for completion > $; ;CAVEAT must escape quotes to cmd.exe in arg(5) > $; [EMAIL PROTECTED]("",0,"*","gema.exe", ?'-f [EMAIL PROTECTED] > ^"%TEMP%\ppro8^" > ^"%TEMP%\ppro8^"',pprofolder++?'scripts',"inv comspec") > $; ;notably above line returns 0 when all is well > $; > $; REQUIRED PLUGINS: > $; OSD.dll on-screen-display -- WinNT derivatives only > $; win.dll > $; miscplugin.dll > $; file.dll > 3.8.18 > $; > $; CONFIGURATION: > $; 1) The following GLOBAL variables must be initialized prior to > calling [EMAIL PROTECTED] > $; global gvOsdFont="Verdana Bold" ;;or whatever suits you > $; global gvOsdSize="36" ;;or whatever suits you > $; global gvOsdColor="255 000 000" ;;or whatever suits you > $; > $; OSD plugin will be called iff gvOsdFont is defined > $; hence do NOT define gvOsdFont on win98 > $; > $; 2) set local PATH variable below > $; PATH adds a lot of flexibility especially when you're running > $; powerpro on multiboot systems or from a usb key > $; > $; 3) run the script a few times, a powerpro debug window may show up > $; listing some values, you may comment out the line calling the > $; debug window - look for string =DEBUG= in this script to find > $; the line that writes to powerpro debug window > $; > $; RETURN VALUE AND ERROR PROCESSING: > $; 0 if single instance already running > $; -1 if no valid path found > $; 9999999 if delay exceeded > $; else see file.runwait plugin exit code (0, -1 or any) > $; you may Exec.OnError("clear") before calling @X then check > $; if global variable _LastError_ <> "" when @X returns > $;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; > ;;;;;;;; > $ > [EMAIL PROTECTED] > $; initialize local PATH variable here > $local PATH=pprofolder++"bin" \+ > $ ++esc(?"\n",?"\")++Env("bin") \+ > $ ++esc(?"\n",?"\")++Env("RootDrv")++?"\bin" \+ > $ ++esc(?"\n",?"\")++?"c:\bin" \+ > $ ++esc(?"\n",?"\")++Env("ProgramFiles") \+ > $ ++esc(?"\n",?"\")++?"c:\Program Files" \+ > $ ++esc(?"\n",?"\")++?"%windir%" \+ > $ ++esc(?"\n",?"\")++"." > $ > $if ( "" == arg(4) ) > $ quit(-1) > $ > $local run_args=arg(5) > $ > $; check for single instance > $local caption=ifelse(arg(3),arg(3),"="++file.name(arg(4))) > $if( "*" != caption && win.handlelist(caption, 1) ) > $ quit(0) > $ > $local i,j > $local s=arg(4) > $local ms=ifelse(miscplugin.is_int(arg(2)),arg(2),0) > $; resolve %envvar% > $for( i=index(s,"%");i;i=index(s,"%") ) > $ j=i+index(select(s,i+1,length(s)),"%") > $;win.debug(scriptname++"@X","["++i++","++j++"] ",select(s,i+1,j- 1)) > $ s=replacechars(s,select(s,i,j),env(select(s,i+1,j-1))) > $endfor > $ > $; search in PATH > $local s1=s > $local p > $;win.debug(scriptname++"@X try to start '"++s++"'") > $for(p=1; not validpath(s) && p<=line(PATH,0); p=p+1) > $ s=line(PATH,p)++?"\"++s1 > $endfor > $if( not validpath(s) ) > $ quit(-1) > $ > $; resolve initial folder > $local folder=ifelse(arg(6),arg(6),file.folder(s)) > $;win.debug(scriptname++"@X start folder '"++folder++"'") > $ > $; show non-blocking on-screen display > $; DO NOT defined GLOBAL gvOsdFont on win9x (no OSD plugin) > $if(index(allglobals,"gvosdfont"))do > $ if( "" != arg(1)) > $ osd.show(arg(1),ifelse(ms<0,0-ms,ms), gvOsdSize, gvOsdFont,"- 1", > gvOsdColor) > $endif > $ > $; process options > $; --------------- > $; command-line program? > $if(index(arg(7),"comspec"))do > $ ; ============================================================ > $ ; N.B.: user must escape all internal quotes as ^" in run_args > $ ; ============================================================ > $ run_args=?' /c "^"'++s++?'^" '++run_args++?'"' > $ s=Env("ComSpec") > $endif > $; invisible? > $local inv=0 > $if(index(arg(7),"inv") || index(arg(7),"hide") || ms<0)do > $ inv=1 > $ if(ms<0) > $ ms=0-ms > $endif > $local mode="normal" > $if(inv)do > $ mode="hide" > $elseif(index(arg(7),"max"))do > $ mode="max" > $elseif(index(arg(7),"min"))do > $ mode="min" > $endif > $ > $; =DEBUG= comment-out the following debug statement after you've > assessed > $; that this script works for you > $win.debug(date++time,scriptname++"@X: path=<"++s++"> args= > <"++run_args++"> folder=<"++folder++"> mode=<"++mode++"> caption= > <"++caption++"> ms=<"++ms++">") > $ > $; run the program > $quit( file.runwait(ms,s,run_args,folder,mode) ) > > --end of posting-- 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/
