> On Oct 5, 2015, at 11:52, David Becher <[email protected]> wrote:
> 
> Well, I have been using PyObjC to even get that far. I joined all the 
> different xattrs bytes together, unzipped them using bzip2,

All that should be done using the skim notes command line tool. You don’t know 
it’s zipped (it not always is), you don’t know you have to put things together 
(it not always needs to), you don’t know what parts to put together. All that 
logic is in the command line tool.

> then I wrote them to disk and then executed
> 
> nsarray = 
> Foundation.NSKeyedUnarchiver.unarchiveObjectWithFile_('savedSkimNotes.plist')
> 
> which gave me a NSArray. And as you can see, it is now human-readable. Before 
> I used NSKeyedUnarchiver, it was not. But now it is. It displays the actual 
> highlighted text in 'contents', the modificationDate, etc.

No, it’s not. You printed some readable text representation of what comes out 
of the unarchiver, *not* the objects themselves.

> 
> As PyObjC seems to have most of the functionality needed, do you know which 
> method to use, to get the 'normal' RGB-Value?

Again, you have to analyze the Obj-C objects that come pout of it (the actual 
objects, not that text representation). And then extract properties of that 
objects you can work with, and turn them into the data you want to have. 
Whatever that is, I don’t know that.

> I already tried to look up the documentation of NSDeviceRGBColor, but google 
> was not very helpful.
> 
> So 
> `type(Foundation.NSKeyedUnarchiver.unarchiveObjectWithFile_('savedSkimNotes.plist')[0]['color'])`
>  ate least yields "objective-c class NSDeviceRGBColor”

That’s a privat class, and therefore undocumented. You should never have to 
concern yourself with any of that though.

The point is that this property is an NSColor (that is documented on our Wiki 
page). And you have to use Obj-C (or PyObjC) to get information from that 
object, like its components. And then do whatever you want with those color 
components.

Christiaan

> 
>> On 05 Oct 2015, at 11:34, Christiaan Hofman <[email protected]> wrote:
>> 
>> The data consists of archived Obj-C objects. It is not meant to be human 
>> readable, it is meant to be used by an Obj-C program such as Skim. If you 
>> want to turn that into some kind of human readable format you should use 
>> Obj-C (or indirectly PyObjC) to inspect those objects, and calculate actual 
>> numbers and strings you may use for whatever purpose you want. BTW, what you 
>> print here is not the actual data, it is just some text description of that 
>> data that’s m,mainly used for debugging purposes.
>> 
>> Christiaan
>> 
>>> On Oct 5, 2015, at 11:24, David Becher <[email protected]> wrote:
>>> 
>>> Hello again,
>>> 
>>> I already saw that there is a command line tool, but can I retrieve all the 
>>> information with it? Like the color of the note?
>>> 
>>> In the meantime I already figured out that I have to use NSKeyedUnarchiver 
>>> to get the 'real' data - and it worked!
>>> 
>>> Now what I get in return is an NSArray, which is now 'human-readable'. 
>>> Below there is an example element of that array.
>>> 
>>> Question: I would like to have some sort of RGB-Value like used to denote 
>>> colors in HTML webpages. I don't quite know what 'NSDeviceRGBColorSpace 0 
>>> 0.976805 0 1' nor to translate it into some sort of RGB(x, y, z) value. Do 
>>> you have an idea?
>>> 
>>> {
>>>     bounds = "{{72, 114.1443}, {195.22439999999978, 106.05060000000002}}";
>>>     color = "NSDeviceRGBColorSpace 0 0.976805 0 1";
>>>     contents = "An IT artifact, implemented in an organizational context, 
>>> is often the object of study in IS behav- ioral-science research. Theories 
>>> seek to predict or explain phenomena that occur with respect to the 
>>> artifacti\U0301s use (intention to use), perceived usefulness, and impact 
>>> on individuals and organi- zations (net benefits) depending on system, 
>>> service, and information quality (DeLone and McLean 1992, 2003; Seddon 
>>> 1997).";
>>>     modificationDate = "2015-10-04 13:56:45 +0000";
>>>     pageIndex = 2;
>>>     quadrilateralPoints =    (
>>>             "{0, 106.05060000000002}",
>>>             "{195.01650000000024, 106.05060000000002}",
>>>             "{0, 95.99760000000002}",
>>>             "{195.01650000000024, 95.99760000000002}",
>>>             "{0, 94.050900000000027}",
>>>             "{195.14969999999994, 94.050900000000027}",
>>>             "{0, 83.99790000000003}",
>>>             "{195.14969999999994, 83.99790000000003}",
>>>             "{0, 82.051200000000009}",
>>>             "{195.01559999999978, 82.051200000000009}",
>>>             "{0, 71.998200000000011}",
>>>             "{195.01559999999978, 71.998200000000011}",
>>>             "{0, 70.051500000000019}",
>>>             "{194.76180000000011, 70.051500000000019}",
>>>             "{0, 59.998500000000021}",
>>>             "{194.76180000000011, 59.998500000000021}",
>>>             "{0, 58.051800000000028}",
>>>             "{195.05880000000019, 58.051800000000028}",
>>>             "{0, 47.998800000000031}",
>>>             "{195.05880000000019, 47.998800000000031}",
>>>             "{0, 46.05210000000001}",
>>>             "{195.03719999999993, 46.05210000000001}",
>>>             "{0, 35.999100000000013}",
>>>             "{195.03719999999993, 35.999100000000013}",
>>>             "{0, 34.05240000000002}",
>>>             "{195.22439999999978, 34.05240000000002}",
>>>             "{0, 23.999400000000023}",
>>>             "{195.22439999999978, 23.999400000000023}",
>>>             "{0, 22.052700000000002}",
>>>             "{194.99850000000032, 22.052700000000002}",
>>>             "{0, 11.99969999999999}",
>>>             "{194.99850000000032, 11.99969999999999}",
>>>             "{0, 10.052999999999997}",
>>>             "{142.73369999999974, 10.052999999999997}",
>>>             "{0, 0}",
>>>             "{142.73369999999974, 0}"
>>>     );
>>>     type = Highlight;
>>> }
>>> 
>>>> On 05 Oct 2015, at 11:12, Christiaan Hofman <[email protected]> wrote:
>>>> 
>>>> It’s a private format.
>>>> 
>>>> However as for the part you have done, it’s better not to do this 
>>>> yourself. There is a command line tool (skimnotes) embedded in Skim to 
>>>> extract the notes data from the file, so you don’t have to deal with the 
>>>> particulars of the extended attributes and assembly of the parts. This is 
>>>> also explained on the Wiki, and there are also some sample scripts using 
>>>> it.
>>>> 
>>>> As for the format, it is really archived Obj-C objects. It may look like a 
>>>> plist, but its format is private, and in this case not documented (it’s 
>>>> made by Apple’s frameworks, and they don’t even tell us it’s a plist). To 
>>>> read it you need to use the NSKeyedUnarchiver obj-C class. As the Wiki 
>>>> page says. This should also be possible from python, though I don’t know 
>>>> much about PyObjC.
>>>> 
>>>> Christiaan
>>>> 
>>>>> On Oct 5, 2015, at 8:15, David Becher <[email protected]> wrote:
>>>>> 
>>>>> Actually, I already figured out how to get to the xargs. By having a look 
>>>>> at the source code I saw that you compressed and splitted the data across 
>>>>> different arg values. I was able to join and uncompress them, resulting 
>>>>> in a plist file (and this with not very much knowledge of Obj-C, I am 
>>>>> kind of proud). Now my question: can maybe someone elaborate on the 
>>>>> plist-structure for skim-notes? I want to parse the plist, however all I 
>>>>> found was this:
>>>>> 
>>>>> http://sourceforge.net/p/skim-app/wiki/Skim_Notes_Keys/
>>>>> 
>>>>> and I don't really understand the structure of that table (is that even a 
>>>>> table, it seems wrongly formatted for a table).
>>>>> 
>>>>> All the best,
>>>>> David
>>>>> 
>>>>> 
>>>>>> On 05 Oct 2015, at 05:10, David Becher <[email protected]> 
>>>>>> wrote:
>>>>>> 
>>>>>> Ah, thanks for that. There See even dedicated Python libraries for xargs 
>>>>>> read access :)
>>>>>> 
>>>>>> Last question: which format did you save the notes in? Just so I know 
>>>>>> how to properly parse :) Is it one of the Obj-C data-types like NSArray?
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Oct 5, 2015, at 12:03 AM, Christiaan Hofman <[email protected]> 
>>>>>> wrote:
>>>>>> 
>>>>>>> 
>>>>>>>> On Oct 4, 2015, at 23:59, David Becher <[email protected]> 
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>> Hello there,
>>>>>>>> 
>>>>>>>> I am right now typing up a python script which - hopefully - can 
>>>>>>>> extract the notes of a given PDF file annotated with Skim. I don't 
>>>>>>>> want to use AppleScript, on the one hand it is actually possible with 
>>>>>>>> AppleScript to export the notes to text, however it does not provide 
>>>>>>>> enough information (color of highlight e.g.).
>>>>>>>> 
>>>>>>>> However, i can't seem to find the physical location in which Skim 
>>>>>>>> writes these notes. It is not the PDF file itself, since its md5sum 
>>>>>>>> does not change. I tried narrowing it down by using `lsof -p 
>>>>>>>> <Skim-PID>`, however ultimately I could not find the file in which it 
>>>>>>>> is being stored.
>>>>>>>> 
>>>>>>>> Can maybe someone help me out? I would have a look at the source code, 
>>>>>>>> however I don't know a thing about Objective-C at all.
>>>>>>>> 
>>>>>>>> All the best,
>>>>>>>> David
>>>>>>> 
>>>>>>> It’s in the extended attributes of the file. That’s also mentioned on 
>>>>>>> the Wiki.
>>>>>>> 
>>>>>>> Christiaan
>>>> 
>> 


------------------------------------------------------------------------------
_______________________________________________
Skim-app-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-users

Reply via email to