Re: Can Excel "Undefine" a Variable?
Re: Can Excel "Undefine" a Variable?
- Subject: Re: Can Excel "Undefine" a Variable?
- From: Jon Pugh via AppleScript-Users <email@hidden>
- Date: Mon, 16 Dec 2024 13:47:47 -0800
This is a manifestation of the AppleEvent interprocess communication underlying
AppleScript. Basically, AppleScript sends commands to Excel, which responds
with the requested data. In this example, AppleScript asks Excel for the value
in the cell, then AppleScript (not Excel) does the text manipulation and
assigns it to a variable. However, since you’re in an Excel tell block, it
sends the whole command to Excel which doesn’t handle text manipulation.
Ostensibly, it could if it were implemented, but it’s not. So you have to
clearly separate the various parts.
AppleScript isn’t a language that benefits from putting everything on one line.
;)
Jon
> On Dec 16, 2024, at 11:54 AM, Gil Dawson via AppleScript-Users
> <email@hidden> wrote:
>
> Thanks, Deivy--
>
> That worked! Son of a gun.
>
> The command "get" is described in the AppleScript developer language guide
> <https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW56>.
>
>
> "get" can be used to force early evaluation of part of an object specifier.
>
> In this case, in the command to Excel...
>
> set SubscriberAddress to (text 15 through -1 of (get the value of cell "A2"))
>
> ...without the "get", I suppose that Excel (or maybe AS) cannot tell that...
>
> the value of cell "A2"
>
> ...is going to be a string of text.
>
> Subtle.
>
> Thanks again.
>
> --Gil
>
> --Gil
>> On Dec 16, 2024, at 4:04 AM, Deivy Petrescu <email@hidden> wrote:
>>
>> It is a while since I scripted Excel, but I believe the issue is with AS.
>> Try:
>>
>> set SubscriberAddress to (text 15 through -1 of ( get the value of cell
>> "A2"))
>>
>> I added the “get”.
>> I’ve noticed this need to put get before certain calls for a while now.
>>
>>
>> Best, be safe.
>>
>> Deivy Petrescu
>> 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
_______________________________________________
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