Re: reading a file >32Kb
Re: reading a file >32Kb
- Subject: Re: reading a file >32Kb
- From: Larry McMunn <email@hidden>
- Date: Thu, 13 Mar 2003 18:19:32 -0500
Hello James Burns:
You should be able to check for your string in your variable. I work with large variables in Applescript everyday. In earlier versions of AS, I couldn't check containing a string in a string over 32k. Interestingly, I could get the offset of the desired string in the target. If that did not error or return 0, then the target contained the desired string. Somewhere along the way, AS changed and you can now check for a string in a large variable.
To make sure that I wasn't mistaken with my comments above, I just created a rather large text file with the following specs:
-- BBEdit says number of lines: 244,831
-- BBEdit says number of characters: 23,182,730
-- Finder says size is: 22.1MB (23,184,440 bytes)
-- the file contains the string "SEMIANNUAL" in line 12
-- the file contains the string "SEMIANNUAL74225" in line 74225
This script works exactly as one would expect:
tell application "BBEdit"
set gcopy to text of text window 1
end tell
if gcopy contains "SEMIANNUAL" then
beep 3
end if
--the script beeps 3 times
delay 3
if gcopy contains "SEMIANNUAL74225" then
beep 5
end if
--the script beeps 5 times
tell application "BBEdit"
activate
make new text window
set text of text window 1 to gcopy
end tell
--a new BBEdit window appears after a second or two
--after about 30 seconds, the new window is populated with the 244,831 lines of text from the variable,
I am using Script Debugger 3.0.5, OSX10.2.4, BBEdit 7.0.3 on 800MHz TiBook, 1GB RAM.
--
Happy Automation! :-)
Larry McMunn
President
McMunn Associates, Inc.
Specialists in automated Data Visualization through Apple products
Collingswood, NJ
(856) 858-3440
---------------------------------------------------------------
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.