handy applescript

Mike Matthews - Omnis omnis at lineal.co.uk
Sun Aug 13 15:08:30 UTC 2023


Very nice :)

Mike Matthews

Lineal Software Solutions
Commercial House, The Strand<x-apple-data-detectors://1/1> Barnstaple, Devon, EX31 1EU<x-apple-data-detectors://1/1>

omnis at lineal.co.uk<mailto:mike.matthews at lineal.co.uk>

www.lineal.co.uk<http://www.lineal.co.uk/>

www.sqlworks.co.uk<http://www.sqlworks.co/>



On 13 Aug 2023, at 12:00, Kelly Burgess <kellyb at montana.com<mailto:kellyb at montana.com>> wrote:

Caution: This is a message which has originated from outside the organisation. Ensure the sender is trusted and the content is safe before opening links or attachments.



I just revised a 'droplet' tool I have, adding Studio 11 awareness. This is a compiled Applescript app whose icon you can drag and drop an Omnis library onto, and it will tell you which version of Studio it was last used with. Saves you from launching a library with the wrong version, having to decline the offer to convert or deal with the 'can't read library' error when there's a version mismatch.

If you don't use Macs, it also serves as a list of the first-byte values you can hex-edit to back-convert a library in some cases.

Paste this script into Apple's Script Editor and save it as a run-only Application that doesn't stay open.

Kelly



on open files_
       repeat with file_ in files_
               set file_ to POSIX path of file_
               -- read the first three bytes
               set foo to (open for access (POSIX file file_))
               set txt to (read foo for 3)
               close access foo
               -- map bytes to version
               set byteOne to ASCII number (first character of txt)
               set byteTwo to ASCII number (second character of txt)
               set byteThree to ASCII number (third character of txt)
               set dialogMsg to file_ & " is not a Studio 3 or Studio 4 library."
               if byteTwo = 1 then -- 0x01
                       if byteOne = 44 then -- 0x2C
                               set dialogMsg to file_ & " is a Studio 3.x library."
                       end if
                       if byteOne = 45 then -- 0x2D
                               set dialogMsg to file_ & " is a Studio 4.x library."
                       end if
                       if byteOne = 46 then -- 0x2E
                               set dialogMsg to file_ & " is a Studio 4.3.1+ library."
                       end if
                       if byteOne = 47 then -- 0x2F
                               set dialogMsg to file_ & " is a Studio 5.0.x library."
                       end if
                       if byteOne = 48 then -- 0x30
                               set dialogMsg to file_ & " is a Studio 5.1.x library."
                       end if
                       if byteOne = 49 then -- 0x31
                               set dialogMsg to file_ & " is a Studio 5.2.x library."
                       end if
                       if byteOne = 50 then -- 0x32
                               set dialogMsg to file_ & " is a Studio 6.0.x library."
                       end if
                       if byteOne = 51 then -- 0x33
                               set dialogMsg to file_ & " is a Studio 6.1.x library."
                       end if
                       if byteOne = 52 then -- 0x34
                               set dialogMsg to file_ & " is a Studio 8.0.x library."
                       end if
                       if byteOne = 53 then -- 0x35
                               set dialogMsg to file_ & " is a Studio 8.1.x library."
                       end if
                       if byteOne = 54 then -- 0x36
                               set dialogMsg to file_ & " is a Studio 10.0.x library."
                       end if
                       if byteOne = 55 then -- 0x37
                               set dialogMsg to file_ & " is a Studio 10.1.x library."
                       end if
                       if byteOne = 56 then -- 0x38
                               set dialogMsg to file_ & " is a Studio 10.2.x library."
                       end if
                       if byteOne = 57 then -- 0x39
                               set dialogMsg to file_ & " is a Studio 11.0.x library."
                       end if
                       if byteThree = 1 then
                               set dialogMsg to dialogMsg & " (Unicode)"
                       end if
               end if
               display dialog dialogMsg buttons {"OK"} default button "OK"
       end repeat
end open



_____________________________________________________________
Manage your list subscriptions at https://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.omnis-dev.com&c=E,1,ug20YixWYVHN0pwrpVwOrgiMg0XLJjvSrFDezN1wWbh_Nm_xsGoAl5kgzkSFc0DeGRYJXGiUctVZiDO-S6Y3GVuMiEsqcDSwSPGrH92szeg,&typo=1
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com



More information about the omnisdev-en mailing list