Page 1 of 1

Stagger Script Edit Windows

Posted: Tue Apr 03, 2018 11:00 am
by pderks
Hi,

I came up with a non-paschal mystery.
Her is a script, that staggers the open Script Editor Windows:

Code: Select all

 put the windows into WindowList
  filter WindowList with "revNewScriptEditor*"
  repeat with ii = 1 to the Number of lines in WindowList
    get line ii of WindowList
    set the Rect of window it to "100,100,1000,600"
    put Patt into fld "Find" of window it
    set the TopLeft of window it to 50 + (ii - 1) * 10,50 + (ii -1) * 10
  end repeat
This script works, If I put it with MouseUp into a button.
This script works, If I put it without MouseUp into the message box..
This script does not work, if I put it at the end of a handler A in the stacks's script, or if I put it into an own handler B in the stack's script, that is called by handler A: all script editor windows lie congruently on top of each other.

Thanks in advance

Peter

Re: Stagger Script Edit Windows - Solved

Posted: Mon Apr 09, 2018 7:26 am
by pderks
Hi,

I inserted the line

Code: Select all

go window WindowLine
so that my code now looks like

Code: Select all

on pda_WindowStagger_ScriptEditor Patt
  put the Windows into WindowList
  filter WindowList with "revNewScriptEditor*"
  repeat with ii = 1 to the Number of lines in WindowList
    put line ii of WindowList into WindowLine
    go window WindowLine
    set the Rect of window WindowLine to "100,100,1000,600"
    put Patt into fld "Find" of window WindowLine
    set the TopLeft of window WindowLine to 50 + (ii - 1) * 10,50 + (ii -1) * 10
  end repeat
end pda_WindowStagger_ScriptEditor
Regards

Peter

Re: Stagger Script Edit Windows - corrected Solution

Posted: Mon Apr 09, 2018 10:04 am
by pderks
Hi,

I correct my latest post giving an example button script:

Code: Select all

on MouseUp
  repeat with ii = 1 to 25
    edit the Script of btn ii
  end repeat
  send "pda_WindowStagger_ScriptEditor" && "on" to me in 10 ticks
end MouseUp
---
on pda_WindowStagger_ScriptEditor Patt
  put the Windows into WindowList
  filter WindowList with "revNewScriptEditor*"
  repeat with ii = 1 to the Number of lines in WindowList
    put line ii of WindowList into WindowLine
    set the Rect of window WindowLine to "100,100,1000,600"
    put Patt into fld "Find" of window WindowLine
    -- next line is optional: reverts the order of the windows
    go window WindowLine
    set the TopLeft of window WindowLine to 50 + (ii - 1) * 25,50 + (ii -1) * 25
  end repeat
end pda_WindowStagger_ScriptEditor
The critical code line is:

Code: Select all

  send "pda_WindowStagger_ScriptEditor" && "on" to me in 10 ticks
Regards

Peter

Re: Stagger Script Edit Windows

Posted: Mon Apr 09, 2018 10:12 am
by Klaus
Hi Peter,

better always use PARENS when concatenating strings:

Code: Select all

...
send ("pda_WindowStagger_ScriptEditor" && "on") to me in 10 ticks
...
However they are not even neccessary here at all:

Code: Select all

...
send "pda_WindowStagger_ScriptEditor on" to me in 10 ticks
...
Should do :-)


Best

Klaus