Re: How to adjust this script to work on Snow Leopard?
Re: How to adjust this script to work on Snow Leopard?
- Subject: Re: How to adjust this script to work on Snow Leopard?
- From: Bert Groeneveld <email@hidden>
- Date: Mon, 22 Nov 2010 17:06:30 +0100
Hello, tried both options (from Yvan and J. Stewart) both without succes. Any other suggestions? Thanks in advance. Bert.
On 22 nov 2010, at 13:46, J. Stewart wrote:
> On 11/22/10 at 5:29 AM, KOENIG Yvan <email@hidden> spake thusly:
>
>>> This (part of a) script only runs on 10.5.8 and not on 10.6. Could anyone tell how to adjust this snippet to make it compatible with 10.6?
>>> tell application "Open_ProductGroups_Server_v01" of machine "eppc://applescript:email@hidden"
>>> set ProductGroups to open_TXT_File()
>>> end tell
>>> - - - - - - - Background info: - - - - - - -
>>> The (Intel) Mac with IP address 192.168.10.21 still has Mac OS 10.5.8 Server installed. I didn't change anything on that Mac.
>>> The application "Open_ProductGroups_Server_v01" is a simple (stay open) applescript that runs on the server and contains the following handler:
>>> on open_TXT_File()
>>> set myFile to "Fotostudio-ServerDisk:B:BIJENKORF TEST MAP BERT AFBLIJVEN:Productgroups:ProductGroups.txt"
>>> set myTXT_File to open for access myFile
>>> set ProductGroups to read myTXT_File
>>> set AppleScript's text item delimiters to "
>>> "
>>> set ProductGroups to every text item of ProductGroups
>>> set AppleScript's text item delimiters to ""
>>> close access myTXT_File
>>> return ProductGroups
>>> end open_TXT_File
>>>
>>
>>
>> I guess that the culprit is the handler.
>>
>> set myTXT_File to open for access file myFile
>>
>> would be better.
>>
>> I would edit the handler this way :
>>
>> on open_TXT_File()
>> set myFile to "Fotostudio-ServerDisk:B:BIJENKORF TEST MAP BERT AFBLIJVEN:Productgroups:ProductGroups.txt"
>> set myTXT_File to open for access file myFile
>> set ProductGroups to read myTXT_File
>> close access myTXT_File
>>
>> set AppleScript's text item delimiters to "
>> "
>> set ProductGroups to every text item of ProductGroups
>> set AppleScript's text item delimiters to ""
>> return ProductGroups
>> end open_TXT_File
>>
>> which close the text file immediately when there is no need to leave it open.
>
> There is no reason to manually open and close a text file just to read it. This should work just fine and be slightly quicker.
>
> on open_TXT_File()
> set ProductGroups to read file "Fotostudio-ServerDisk:B:BIJENKORF TEST MAP BERT AFBLIJVEN:Productgroups:ProductGroups.txt"
>
> set AppleScript's text item delimiters to "
> "
> set ProductGroups to every text item of ProductGroups
> set AppleScript's text item delimiters to ""
> return ProductGroups
> end open_TXT_File
>
> JBS
> --
> Under a government which imprisons any unjustly, the true place for a just man is also in prison. -Henry David Thoreau
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden