Grepx
From Director Online Wiki
This handler will search the given xtra's interface for lines matching the supplied regular expression. Only the first few letters of the xtra's name are required. The search is global and case insensitive. Requires the PRegEx xtra.
Examples
-- Welcome to Director -- grepx "bu", "create" -- "* baCreateFolder string Foldername -- creates Foldername and returns 1 if successful * baMakeShortcut string File, string Folder, string Title -- creates Alias " grepx "pr", "http:" -- "Ambiguous xtra reference: PrintOMatic_Lite PRegEx " grepx "pre", "http:" -- "xtra PRegEx -- Regular Expresssion Xtra -- http://openxtras.org/ -- Uses Perl-Compatible Regular Expressions (PCRE) -- http://pcre.org/ "
grepx "bin", "." --(displays the entire interface of xtra "binaryio")
grepx "" -- "Ambiguous xtra reference: -- (then displays all xtras)
The Script
on grepx(xName, ptrn) ------------------------------------------------ -- INPUT: <xname> Name of the xtra whose interface is to be -- searched. Only the first few characters are required. If -- more than one xtras are matched, then those names are -- returned with the message "Ambiguous xtra reference:". -- <ptrn> Regular expression to use when searching the xtra's -- interface. -- OUTPUT: String with lines matching the the supplied regex. -------------------------------------------------------------------- xNameStr = "" repeat with i = 1 to (the xtras).count if ((xtra i).name starts xName) then put (xtra i).name & RETURN after xNameStr end repeat case (xNameStr.line.count) of (2): -- Good! Matched exactly one xtra name so use that. (Length is 2 because we appended a return.) ifStr = (xtra xNameStr.line[1]).interface() ifLst = [] repeat while ifStr.length add ifLst, ifStr.line[1] delete ifStr.line[1] end repeat rslt = PRegEx_Grep(ifLst, ptrn, "i") -- Search ignoring case. repeat while rslt.count put rslt[1] &RETURN after ifStr deleteAt rslt, 1 end repeat (1): -- Couldn't find any xtras whose names begin with xName. ifStr = "Error: xtra not found" &RETURN &xName &RETURN otherwise -- Matched more than one xtra so just display what we found. ifStr = "Ambiguous xtra reference:" &RETURN &xNameStr end case put ifStr -- Display results in the message window. return ifStr -- And return as a string. end grepx
--[[User:Cole|CBT]] 13:19, 12 Oct 2005 (MDT)
Download
Here's a miaw utility with the above script: grepx.dir.zip Drop it in your xtras folder and restart director. Grepx will then be available in the xtras menu. Enter xtra's partial name and pattern in the text field without quotes and press return to run return. The results will be in the message window. For example: to print the website for buddy api enter bu http and press return. Or for email and web addresses use http|@.