Hi,
I have been working on a script to rename files in a target folder. Basically I wanted the script to repeat until all files were renamed using two automator apps for replacing text in the filename. The script worked the first couple of times and then when testing it with additional files I suddenly got “FLV_rename got an error: Connection is invalid”. I was wondering if anybody could sheet some light on this or have encountered this problem before?
here is the script:
set targetFolder to ((path to desktop) as string) & "TEST_FOLDER"
set blnAnswer to false
repeat while blnAnswer = false
tell application "Finder"
repeat with folderCounter from 1 to count of files in folder targetFolder
set inputFiles to (name of file folderCounter of folder targetFolder) as string
set outputFiles to (name of file folderCounter of folder targetFolder) as string
if inputFiles contains "_01_001_110001_WMV" then
tell application "WMV_rename"
open inputFiles
end tell
else if inputFiles contains "_01_001_110001_FLV" then
tell application "FLV_rename"
open inputFiles
end tell
else if outputFiles contains "_od" or outputFiles contains "_640" then
set blnAnswer to true
end if
end repeat
end tell
end repeat
Also a couple of times this process forced Automator to quit with the following error log (not sure if it is any help)
Process: FLV_rename [2613]
Path: /Users/jonathan/Desktop/Automator/FLV_rename.app/Contents/MacOS/FLV_rename
Identifier: com.apple.automator.FLV_rename
Version: 1.0 (160)
Build Info: Automator-1600000~1
Code Type: PPC (Native)
Parent Process: launchd [128]
Date/Time: 2008-09-29 16:11:58.204 +0100
OS Version: Mac OS X 10.5.4 (9E17)
Report Version: 6
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000c0000023
Crashed Thread: 1
Thread 0:
0 libSystem.B.dylib 0x96c28438 mach_msg_trap + 8
1 libSystem.B.dylib 0x96c2f35c mach_msg + 56
2 com.apple.CoreFoundation 0x92517568 CFRunLoopRunSpecific + 1812
3 com.apple.Foundation 0x960ffc68 -[NSConnection sendInvocation:internal:] + 2308
4 com.apple.CoreFoundation 0x9258a718 forwarding + 696
5 com.apple.CoreFoundation 0x9258a834 _CF_forwarding_prep_0 + 212
6 com.apple.Foundation 0x960d074c __NSThreadPerformPerform + 340
7 com.apple.CoreFoundation 0x925172a4 CFRunLoopRunSpecific + 1104
8 com.apple.HIToolbox 0x910e372c RunCurrentEventLoopInMode + 264
9 com.apple.HIToolbox 0x910e3550 ReceiveNextEventCommon + 412
10 com.apple.HIToolbox 0x910e3390 BlockUntilNextEventMatchingListInMode + 84
11 com.apple.AppKit 0x93231058 _DPSNextEvent + 596
12 com.apple.AppKit 0x93230a10 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 112
13 com.apple.AppKit 0x9322a6cc -[NSApplication run] + 736
14 com.apple.AppKit 0x931fb0d0 NSApplicationMain + 440
15 com.apple.automator.FLV_rename 0x00002578 0x1000 + 5496
16 com.apple.automator.FLV_rename 0x000024f8 0x1000 + 5368
Thread 1 Crashed:
0 libobjc.A.dylib 0xfffeff18 objc_msgSend_rtp + 24
1 com.apple.Foundation 0x960cbe44 NSPopAutoreleasePool + 516
2 com.apple.AutomatorFramework 0x001e90a4 -[AMWorkflowRunner _run] + 1992
3 com.apple.Foundation 0x960cfdec NSThread__main + 1004
4 libSystem.B.dylib 0x96c6a658 _pthread_start + 316
Thread 2:
0 libSystem.B.dylib 0x96c2ee4c __semwait_signal + 12
1 libSystem.B.dylib 0x96c6ba00 _pthread_cond_wait + 1580
2 com.apple.Foundation 0x9610e8f0 -[NSCondition wait] + 268
3 com.apple.Foundation 0x960d0288 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 932
4 com.apple.Foundation 0x96118ef0 -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 144
5 com.apple.AutomatorFramework 0x001e8d34 -[AMWorkflowRunner _run] + 1112
6 com.apple.Foundation 0x960cfdec NSThread__main + 1004
7 libSystem.B.dylib 0x96c6a658 _pthread_start + 316
Thread 1 crashed with PPC Thread State 32:
srr0: 0xfffeff18 srr1: 0x0000f030 dar: 0xc0000023 dsisr: 0x00200000
r0: 0x00000001 r1: 0xf007fee0 r2: 0x0082f07c r3: 0x11a4bec0
r4: 0x93b7d110 r5: 0x00000464 r6: 0x00004c79 r7: 0x00000003
r8: 0x11afc080 r9: 0x00000000 r10: 0x0082f000 r11: 0x6c49d110
r12: 0xc0000003 r13: 0xf00808f8 r14: 0x002c88dc r15: 0x002c88dc
r16: 0x006474f0 r17: 0x002c88dc r18: 0x00647240 r19: 0x002c88dc
r20: 0x002c88dc r21: 0x002c88dc r22: 0x00000003 r23: 0x00000000
r24: 0x002c88dc r25: 0x00643380 r26: 0x11a05930 r27: 0x11a05930
r28: 0x0064b070 r29: 0x0029fd3c r30: 0x00634a10 r31: 0x960cbc48
cr: 0x44002224 xer: 0x00000000 lr: 0x960cbe48 ctr: 0x96c297d0
vrsave: 0x00000000