Regular Expressions within ASOC

has anyone had any luck using a regular expression within an ASOC project?

I wrote an AS script that returns a list by using a regular expression. I would like to populate a text field in my ASOC project with the list from my applescript script. I copied and pasted the script into the ASOC project and the project stopped working right at the regular expression. Here’s the chunk of code that has the regex:


	tell application "AppleScript Editor"
		repeat with i from 1 to pageOneCount
			set fileName to item i of adFolderContents
			set my singleVersion_Field to "hi" as text   ----I just used this to see where my text field stopped getting populated...it works here but stops when I move it below the next line-----
			
			set adCounties to find text "01_" & "[A|a|J|j|L|l|M|m]+" & "([A-Z|a-z]*)(\\(([A-Z|a-z]?)|([A-Z|a-z]))*" in fileName with regexp and string result
			--to remove the 01 from the variable
			
			
			set adCounties to adCounties as text
			
			set AppleScript's text item delimiters to "_"
			set adCounties to text item 2 of adCounties
			--display dialog adCounties
			set AppleScript's text item delimiters to ""
			
			set multipleAdVersions to count of items in adCounties
			--display dialog multipleAdVersions
			
			try
				if multipleAdVersions is greater than 2 then
					--display dialog multipleAdVersions
					set divisionType to item 1 of adCounties
					--display dialog divisionType
					repeat with i from 1 to multipleAdVersions
						
						set multipleAdCount to item (i + 2) of adCounties
						--set adCounties to divisionType & multipleAdCount
						set multiAdCount to divisionType & multipleAdCount as text
						--display dialog multiAdCount
						set end of adVersionList to multiAdCount & return as text
						
					end repeat
				end if
			end try
			
			
			if multipleAdVersions is less than 3 then
				set singleAdVersion to items 1 thru 2 of adCounties as text
				--display dialog singleAdVersion
				set end of adVersionList to adCounties & return as text
			end if
		end repeat
		end tell

As always, any help would be greatly appreciated!

The “find text” command you’re using is not a built-in AS command but part of the Satimage scripting addition. I wonder if the real problem is that it’s not happy in 64-bit mode.

When you run the script, do you see a message like this in Console:

Satimage.osax/Contents/MacOS/Satimage: dlopen(/Users/shane/Library/ScriptingAdditions/Satimage.osax/Contents/MacOS/Satimage, 262): no suitable image found. Did find:
/Users/shane/Library/ScriptingAdditions/Satimage.osax/Contents/MacOS/Satimage: no matching architecture in universal wrapper

I think the latest version of Satimage.osax fixes the problem.

I’m not at work today but I do know that when I first started working on this chunk of code applescript didn’t recognize the regular expression in script editor until we told the program to run in 32 bit mode. (I think it was in the properties window of the smile application… it had a check box that said “run in 32 bit mode”.) After checking the box script editor no longer had a problem with the regex.

I’ll check the console tomorrow and post it’s error.

Thanks

I think you can force it to run as 32-bit by changing x86_64 to i386 in the pop-up menu in the toolbar (the one that says “10.6 | Debug | x86_64”). And I think there’s a 64-bit beta of Satimage.osax available from the author.

Shane you’re the man. Thanks so much! I changed it to the i386 setting like you said and it worked!!