--- In [email protected], "lakeshoresurfer" <[EMAIL PROTECTED]> wrote:
>
> Hi Sheri !
> 
> Thanks for the great advice.
> 
> Could you explain the line :
> 
> if (win.exename("*")=="iexplore" and index(win.caption("*"), 
> "gmail"))
> 
> I could not find the index() feature in the documentation but by
> watching at the expression it would give a 1 if the expression in
> the brackets is true. Which would mean if the caption of the
> active window is gmail.

It should give the 1-based starting position of the second string in
the first.

The documentation gives us: 

"select, index, revindex
These are 1-based versions of slice, find, and revfind, respectively."

When slice, find and revfind were added, apparently they got pulled
from relevant listing in the documentation.

Because index is 1-based, it means it is false if the index is 0/not
found, and true otherwise. But you could "find" instead: 


LCmd: if
LParam1: (win.exename("*")=="iexplore" and (find(win.caption("*"),
"gmail") > -1))

> 
> There comes my next question : Does it have to be "*gmail*" 
> or "gmail" ? I would assume that according to the caption list 
> documentation "*gmail*" would match if gmail is anywhere in the 
> caption and "gmail" would have to be the exact caption to be
> matched.

index and find are not a match functions. They look for the starting
point of one string in another. So unless the caption title has gmail
surrounded by asterisks, use "gmail" not *gmail*.
> 
> I modified my command as follows :
> 
> Cmd    : if
> Cmd Par: (win.exename("*")=="pcsws" and index(win.caption
> ("*"),"*Session*"))
> More Cmd: clip.set (replacechars(clip.get," ","")) 
> 
> This should technically replace all spaces with "" whenever the clip 
> was copied on the active screen from exename "pcsws" AND when the 
> caption contains "Session" anywhere.
> 
> However it is not working.  Any ideas ?
>

I'm not sure this is the only problem but ...

More Commands are not used in command lists that are run as scripts.

In a normal command list that not being run as a script, you can have
the main command run More Commands as a script. I believe you are then
constrained to have the entire "more commands" be less than 531
characters.

In this case (since the command list is already being run as a
script), the "if" needs to have its own command block.

It is MUCH easier to edit a script in a file.

Regards,
Sheri

Reply via email to