I have an old Applescript for searching and pasting, but it no longer seems to
work, seems to fail. What am I doing wrong here?
property SearchItems : {}
property SearchPattern : ""
property CollumNames : ""
-- define the search target:
-- search a complete folder:
set SearchItems to choose folder with prompt "Choose a search folder:" -- ask
the user to specify a search folder
-- specify the search pattern:
set DialogResult to display dialog "Search for:" default answer SearchPattern
with icon note buttons {"Cancel", "OK"} default button 2
if button returned of DialogResult is not "Cancel" then
set SearchPattern to text returned of DialogResult
end if
tell application "BBEdit"
set myNewWindowData to ""
find "^.*" & SearchPattern & ".*$" searching in SearchItems options
{search mode:grep, case sensitive:false, returning results:true}
if found of the result then
set findResults to found matches of the result
repeat with theResultItem in findResults
open (result_file of theResultItem)
set s to characters (start_offset of theResultItem)
thru (end_offset of theResultItem) of window 1
set myNewWindowData to myNewWindowData & s & return as
string
close window 1
end repeat
end if
make new text window with properties {contents:myNewWindowData}
set CollumNames to "Reel Name Log Note Media Start
Media End Tracks" as text
copy (CollumNames as string) & return to insertion point before
character 1 of text window 1 -- goto line 1
end tell
-Jonah Lee
•Read My Movie Reviews
•Read My Restaurant and Wine Reviews
•Read My Resume
•Read My Biography
On Jul 2, 2010, at 2:15 PM, Miraz Jordan wrote:
> On Sat, Jul 3, 2010 at 09:02, Jonah Lee Walker <[email protected]> wrote:
>> So I want to either write an applescript to automate a search for
>> multiple files, or a search expression so that I can extract
>> everything between the <img src=" and " border=0> in the document and
>> have them all pasted into another document, skipping everything else
>> in the document.
>
> I'd write an Applescript that did these things:
>
> * add Return characters before <img src
> * add Return characters after border=0>
>
> That would isolate the desired strings on their own lines.
>
> * Process lines containing ... <img src , setting it to Copy to New Document.
>
> Done.
>
> You should be able to Record such a script easily.
>
> Cheers,
>
> Miraz
>
>
>
>
>
> --
> Miraz Jordan
>
> MacTip: Edit and use Safari 5's Top Sites -
> http://mactips.info/2010/06/edit-and-use-safari-5s-top-sites
>
> KnowIT: What should visitors do next? -
> http://knowit.co.nz/2010/07/what-should-visitors-do-next
>
> Tech Universe: http://nzherald.co.nz
>
> --
> You received this message because you are subscribed to the
> "BBEdit Talk" discussion group on Google Groups.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/bbedit?hl=en
> If you have a feature request or would like to report a problem,
> please email "[email protected]" rather than posting to the group.
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.