RE: Word length
RE: Word length
- Subject: RE: Word length
- From: "Ruby Madraswala" <email@hidden>
- Date: Wed, 6 Oct 2004 16:58:48 -0400
- Thread-topic: Word length
Works fine on OS 9
set lencnt to length of staple_code
display dialog staple_code
on OS 9 displays the correct word length (ex. 4) on OS 10.3.5 same word displays the length of 9. and I cannot figure out why?
Ruby
-----Original Message-----
From: applescript-users-bounces+rubym=email@hidden [mailto:applescript-users-bounces+rubym=email@hidden] On Behalf Of Graff
Sent: Wednesday, October 06, 2004 4:38 PM
To: AppleScript AppleScript Users
Subject: Re: Word length
This script seems to work just fine for me. I changed it a little so
that it would write the file to my desktop. It creates a file and then
puts the numbers in it just fine.
If you are having problems with the program maybe you are attempting to
create the file where you don't have permissions?
Here's my modified version:
----
set button_name to "OK"
set user_stuff to display dialog ¬
"Enter Number:" default answer ¬
" " buttons {"Exit", "OK"} default button "OK"
set button_name to button returned of user_stuff
set style_no to text returned of user_stuff
-- changed next line so that the file is created on the current user's
desktop
set fname to (path to desktop as string) & style_no & ".tem"
set file_ref to open for access file fname with write permission
set button_name to "OK"
set code_list to {}
repeat until button_name is "Exit"
set user_stuff to display dialog ¬
"Enter Code:" & code_list default answer ¬
" " buttons {"Exit", "OK"} default button "OK"
set button_name to button returned of user_stuff
if button_name is "OK" then
set staple_code to text returned of user_stuff
set eof_value to get eof file_ref
write staple_code & return to file_ref starting at (eof_value + 1)
set lencnt to length of staple_code
display dialog staple_code
end if
end repeat
close access file_ref
----
- Ken
On Oct 6, 2004, at 4:16 PM, Ruby Madraswala wrote:
> Only reason for not posting the script was it worked on OS 9 and
> thought there is a logical reason for this behavior. (it's on an
> English based system).
>
> set button_name to "OK"
> set user_stuff to display dialog ¬
> "Enter Number:" default answer ¬
> " " buttons {"Exit", "OK"} default button "OK"
> set button_name to button returned of user_stuff
> set style_no to text returned of user_stuff
>
> set fname to "HD:" & style_no & ".tem"
> set file_ref to open for access file fname with write permission
>
> set button_name to "OK"
> set code_list to {}
> repeat until button_name is "Exit"
> set user_stuff to display dialog ¬
> "Enter Code:" & code_list default answer ¬
> " " buttons {"Exit", "OK"} default button "OK"
> set button_name to button returned of user_stuff
>
> if button_name is "OK" then
> set staple_code to text returned of user_stuff
> set eof_value to get eof file_ref
> write staple_code & return to file_ref starting at (eof_value + 1)
> set lencnt to length of staple_code
> display dialog staple_code
> end if
> end repeat
> close access file_ref
>
>
> -----Original Message-----
> From:
> applescript-users-bounces+rubym=email@hidden
> [mailto:applescript-users-
> bounces+rubym=email@hidden] On Behalf Of Graff
> Sent: Wednesday, October 06, 2004 3:39 PM
> To: AppleScript AppleScript Users
> Subject: Re: Word length
>
> You probably should post the script on this list, otherwise we really
> can't tell what's wrong with it.
>
> Offhand I'd say that maybe this is a unicode issue but I can't really
> tell without more information. Are you on a non-English system?
>
> - Ken
>
> On Oct 6, 2004, at 2:17 PM, Ruby Madraswala wrote:
>
>> I have a script which work fine on OS 9.Now I want to use the same
>> script on OS 10.
>>
>> The script
>> - prompts user to enter words
>> - creates a list of entered words.
>> - Reads the list and matches with filename and copies the content of
>> the file in a new file.
>>
>> In OS 9 the length of word is 4 and for the same word the length in OS
>> 10.3.5 is 9. It seems like it is padding with spaces which is not
>> visible. any reason Why? And how can I resolve this.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
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:
This email sent to email@hidden