HC Home handlers
MisterX
b.xavier at internet.lu
Sat Mar 26 02:22:55 EST 2005
Here you go Mickey.
Note that they are adapted from the XOS core so some things may refer to some functions like stackname() which i didn't edit... but it should be obvious
the searchscript wasn't checked or verified but should work...
cheers
Xavier
on BX
edit script of this bg
end BX
function BgScript abg
if there is a bg abg
then return Script of bg abg
else return script of this bg
end BgScript
on CX c
edit script of this cd
end CX
on ss p,stkName,srchFiltr
if stkname = "" then put the short name of this stack into stkname
put the number of lines in stkname into scount
repeat with x = 1 to scount
lock messages
searchScript p,line x of stkName,srchFiltr
end repeat
answer "Search script done!"
end ss
on ssinuse what
ss what,the stacksinuse & cr & "xos","stack only"
end ssinuse
on mss p
ss p,the stacksinuse,"Stacks only"
centerwindow
end mss
on SearchScript p,stackName,srchFiltr
if pattern = "?" then
put "searchScript <pattern [[or][and][not] pattern]>,stackList,[[not|only] [stack[s],bg[s],[cd[s]]fld[s]|btn[s]]]"
exit searchscript
else if pattern = "??" then
put "searchScript <pattern [[or][and][not] pattern],[stacklist],[[no] bgs|cds]|[[not][stack|bgs|bg fld|bg btn|cds|cd fld|cd btn]"
exit searchscript
end if
-- search ALL scripts of a stack for a 'pattern' of characters
-- search filter allows to filter out scripts to search
lock Recent
u5
push cd
if p = "" then -- get search string from the user
ask "Search for what string?" with ScriptFindString -- ᆴ
if (it = "") or (the result = "Cancel") then exit searchScript
put it into p -- otherwise use it as the search pattern
end if
-- put in global so just use CMD-F in editor for easy find
put p into ScriptFindString
lock Messages
if stackName <> "" then go to stack stackName
-- Note: if stackName = "" then we search the current stack
ImBusy
local stackscripts,bgsscripts,cdsscripts
local bgscripts,cdscripts
local bgfldscripts,bgbtnscripts
local cdfldscripts,cdbtnscripts
put "not stack" is not in srchFiltr into stackscripts
put "no bgs" is not in srchFiltr into bgsscripts
put "no cds" is not in srchFiltr into cdsscripts
put "not bgs" is not in srchFiltr into bgscripts
put "not bg fld" is not in srchFiltr into bgfldscripts
put "not bg btn" is not in srchFiltr into bgbtnscripts
put "not cds" is not in srchFiltr into cdscripts
put "not cd fld" is not in srchFiltr into cdfldscripts
put "not cd btn" is not in srchFiltr into cdbtnscripts
if srchFiltr is in "stacks only stks only stack only stack scripts" then
put true into stackscripts
put false into bgsscripts
put false into cdsscripts
end if
if srchFiltr = "bgs only" then
put false into stackscripts
put true into bgsscripts
put false into cdsscripts
end if
if srchFiltr = "cds only" then
put false into stackscripts
put false into bgsscripts
put true into cdsscripts
end if
-- search the stack script of the stack
if srchFiltr = "" or stackscripts then
if the script of this stack contains p
then edit script of this stack
end if
-- search the background scripts and objects of the stack
if srchFiltr = "" or bgsscripts then
put the number of bgs into bcount
repeat with curBkgnd = 1 to bcount
ImBusy
go to cd 1 of bg curBkgnd
if srchFiltr = "" or bgscripts then
if the script of this bg contains p
then edit script of bg curBkgnd
end if
if srchFiltr = "" or bgbtnscripts then
put the number of bg btns into bbcount
repeat with curBgBtn = 1 to bbcount
ImBusy
if the script of bg btn curBgBtn contains p
then edit script of bg btn curBgBtn
end repeat
end if
if srchFiltr = "" or bgfldscripts then
put the number of flds into fcount
repeat with curBgFld = 1 to fcount
ImBusy
if the script of fld curBgFld contains p
then edit script of fld curBgFld
end repeat
end if
end repeat
end if
if srchFiltr = "" or cdsscripts then
-- search the card scripts and objects of the stack
put the number of cards into ccount
repeat with curCard = 1 to ccount
ImBusy
go card curCard
if srchFiltr = "" or cdscripts then
if the script of this cd contains p
then edit script of this cd
end if
if srchFiltr = "" or cdbtnscripts then
put the number of btns into cbcount
repeat with curCdBtn = 1 to cbcount
ImBusy
if the script of btn curCdBtn contains p
then edit script of btn curCdBtn
end repeat
end if
if srchFiltr = "" or cdfldscripts then
put the number of cd flds into cfcount
repeat with curCdFld = 1 to cfcount
ImBusy
if the script of cd fld curCdFld contains p
then edit script of cd fld curCdFld
end repeat
end if
end repeat
end if
pop cd
lock Messages
lock Recent
restoreUserLevel
end SearchScript
on mss p
ss p,the stacksinuse,"Stacks only"
centerwindow
end mss
on xy
local lastxy
repeat until the mouseClick
get the mouseLoc && " horz:" & the mouseH && " vert:" & the mouseV
if it is not lastxy then
put it
put it into lastxy
end if
end repeat
end xy
on se -- type "se" into message box
-- Requires XWindow: Script Editor
ask "Set script editor font type to:" with "Monaco" -- ᆴ default value
if the result = "Cancel" or it = "" then exit se
set scriptTextFont to it
ask "Set script editor font size to:" with "9" -- ᆴ default value
if the result = "Cancel" or it = "" then exit se
set scriptTextSize to it
end se
on nav
palette "Navigator"
end nav
on c
select this card of the topStack
palette "Properties"
end c
on b
-- ??
end b
on s
select the topStack
palette "Properties"
end s
on mw
get "message Watcher"
if not the visible of window it
then show window it
else hide window it
end mw
on vw
get "Variable Watcher"
if not the visible of window it
then show window it
else hide window it
end vw
More information about the use-livecode
mailing list