Hi i have a string which needs to hold more characters than it does at the moment. When the string holds more than allowed it throws an error. Is there a way i can get the string to hold any amount of characters, even say 30000 words of so? ← not that i need that many just want to be able to hol dmore.
if i spilt the above strings information then the error isnt displayed so it must be that!
I don’t think that you can control the limits of AppleScript. With that said, if I run the following, it does not produce an error, so I wonder if it’s AppleScript or IE that is causing the problem (your error indicates IE)
set f to "stop"
set counter to 0
repeat 30000 times
set counter to counter + 1
try
set f to f & ("go" & return)
on error e
display dialog e & return & counter
end try
end repeat
Tested on OS X 10.2.6. While it didn’t produce an error, it did make the fan of my PowerBook kick on after a couple of tests.
Hmmmm, although when i do save the caption and display it in a dialog it doesnt save it all.
for example
the full string:
This is theful lstring nowt special reallybut its full
the caption variable:
This is theful lstring no
this sometimes happens and only when the error comes, so it led me to belive that there was a limit to the characters of possible bytes that it could store.
i know in java that ints can only hold a set number of bytes and if it goes over then an error occures, so this might be the same??
The captions that cause these errors are in the region of 100 - 300 words, nearer the top end.
I’m sure that there are storage limits but they should be well beyond 300 words. If you are attempting to force 100 - 300 words into a ‘display dialog’, the script will likely fail. I think the limit for a dialog is < 300 characters.
Update: The script might not fail but you will likely see truncation in the dialog.
‘display dialog’ can only handle 255 characters and will truncate any longer strings before displaying them.
If you need to handle more characters than a string can handle, either use a list, multiple string objects, or use ‘unicode text’ rather than ‘string’. Unicode text has no significant length limitations.
That’s correct - display dialog still has a 255 character limit, even if using unicode text - my original intent was to highlight the fact that unicode text doesn’t suffer from the same length limitation as strings.
Just what is it you’re trying to do with this text?
It’s well within the length limits for an AppleScript text object, so if you’re generating an error, it must be related to what you’re trying to do with it and not the text itself.
what i am trying to do is get the caption from photoshop, as explained above i can do this, save that caption as avariable then in IE use the variable in a url query that will upload the information to a database.
admin.asp?caption=“&documentCaption&” ← for example
If i just copy and paste the caption from the file manually then upload it will store the caption. Which should be the same as the above, as the url that is sent stores the information the same way.
There is no need for me to encode the string with all the %20 and so on, as when i do this with a smaller caption it does it all and there are no problems.
I can’t really work out why it doesnt work. there is no reason why it shouldn’t work.
I am just trying to solve the problem and all i have come across is the length of the caption throughs the error.
I still think this is an encoding issue. When you add text to a form field, the browser will encode it for you. When you add it through a URL, it is up to you to encode it.
What do you mean “successful dynamic upload”? If you mean you’ve added the caption to a field and submitted the form and this is the URL that is returned, then you’ve made my point that you need to encode the string if you are going straight to a URL as opposed to using a form field that will automatically encode the value for you.
sorry what i meant by dynamic was that the script does it all and is different every time.
so when i said successful dynamic upload i meant that the scipt did it all automatically. Just me being poncy i’m afraid and trying to sound clever. :oops:
I havent got a method in the script that encodes the URl it simply works with openURL.
So basically what i am saying is that the URL doesn’t get encoded my end, seems to get encoded in transit. I have never needed to encode the caption or the URL for that matter since doing this, and its been successfull for about 600 images. Just the few that have a large caption seem to cause conflicts