On Mar 5, 2011, at 23:03, Artemio González López wrote:

> 
> On Mar 4, 2011, at 11:35 PM, Christiaan Hofman wrote:
> 
>> On Mar 4, 2011, at 21:17, Artemio González López wrote:
>>> 
>>> Dear Christiaan,
>>> 
>>> I've done a few tests with AppleScript, with mixed (and quite baffling) 
>>> results. The first script you mention in your message works flawlessly 
>>> (replacing "go to line 1000" by "go to TeX line 1000", but that was just a 
>>> typo in your email, I think). However, the second and third ones fail 
>>> miserably. More precisely, the file is opened if it wasn't already, but its 
>>> corresponding window stays on the first page, or (if the file was already 
>>> open) its window is selected, but stays wherever it was. Moreover, the 
>>> script never completes (it just says "Running" in the results log) unless 
>>> stopped by hand (and it takes quite a while to stop, actually). In fact, 
>>> from the event log one can see that the only events processed are (if the 
>>> file in question is /Users/Shared/myfile.pdf)
>>> 
>>> tell application "Skim"
>>>     activate
>>>     open file "Mac OS X Lion:Users:Shared:myfile.pdf"
>>> 
>> 
>> Why do you get the 'file' specifier? Such a specifier is generally broken 
>> (at least in 10.6 and earlier, I have little hope 10.7 fixes this; this is 
>> an AppleScript bug). You should create a variable using 'POSIX file', 
>> preferably outside the 'tell' block (inside the 'tell' block it's not 
>> guaranteed to work, and Apple has hinted that in the at some point it may 
>> not work). Also, a 'POSIX file' specifier should not be automatically 
>> expanded into a 'file' specifier as above, it did so before 10.5 which I 
>> remember always gave serious problems.
>> 
>>> (By the way, I tried the same thing withe files whose path didn't contain 
>>> spaces, like "/Volumes/TRANS-IT/foo.pdf", and the behavior was the same). 
>>> So it seems to me the problem is either with the open command or with the 
>>> filename format Skim is expecting, but (since no errors are reported in the 
>>> system log) I have no idea of what the heck is going on. Any suggestions?
>>> 
>>> Thanks again,
>>> 
>>> Artemio
>>> 
>> 
>> It certainly should not do this. This really sounds like a bug in Cocoa 
>> Scripting or basic AppleScript support, as the "open" command is provided by 
>> Apple. 
>> 
>> Does it also do this when there is no "go to TeX line" after this? Or when 
>> it is replaced by some other AppleScript, in particular some standard 
>> AppleScript commands? 
>> 
>> I would urge you to file a bug report with Apple about this 
>> (http://bugreport.apple.com), also reporting explicit AppleScripts to 
>> reproduce the problem, best is when they rely only on standard commands 
>> (otherwise Apple may wrongly say it's not their problem), and if you can 
>> reproduce similar problems with Apple's own scriptable apps it really is 
>> clear. I think we can only hope Apple fixes this before the actual release.
>> 
>> Christiaan
> 
> Dear Christiaan,
> 
> Before filing the bug report, I've experimented a bit more following your 
> suggestions. If I run the script
> 
> set theFile to POSIX file "/Volumes/TRANS-IT/fm-2.pdf"
> tell application "Skim"
>       activate
>       open theFile
>       close theFile
> end tell
> 
> Skim is activated and the pdf file opened (if it's not already open), the 
> script runs for almost a couple of minutes before timing out, and I get the 
> following output in the event and result windows:
> 
> tell application "Skim"
>       activate
>       open file "TRANS-IT:fm-2.pdf"
> Result:
> error "Skim got an error: AppleEvent timed out." number -1712
> 
> If I try exactly the same script with Preview, the file is opened and the 
> script end immediately, with the following output:
> 
> tell application "Preview"
>       activate
>       open file "TRANS-IT:fm-2.pdf"
>               --> missing value
>               --> error number 0
>       close file
>               --> error number -1708
> Result:
> error "Preview got an error: file doesn’t understand the close message." 
> number -1708 from file
> 
> As you can see, in both cases the POSIX file specifier is automatically 
> expanded into a file specifier, but Preview also signals a weird 
> "missing value" error after open that is quite puzzling. Any ideas?
> 
> Thanks again,
> 
> Artemio


So how does it work with a scriptable app from Apple, like TextEdit?

And can you sample Skim while the 'open' command is running? (Activity 
Monitor.app, select Skim, View > Sample Process).

Christiaan


------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Skim-app-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-users

Reply via email to