Re: "Expected class name but found application constant or consideration"...
Re: "Expected class name but found application constant or consideration"...
- Subject: Re: "Expected class name but found application constant or consideration"...
- From: Axel Luttgens <email@hidden>
- Date: Wed, 22 Apr 2015 10:46:15 +0200
> Le 22 avr. 2015 à 00:52, Jean-Christophe Helary a écrit :
>
> In my never ending quest to automate most of my boring processes I've bumped into another wall.
>
> What I'm doing is I first write scripts, test them, then transform them into functions so that I can call them in a bigger script.
>
> Yesterday I was working on that date conversion thing that I mentioned earlier.
>
> It starts like this:
>
> on ConvertApplescriptDatetoString:ArbitraryCurrentDate
> # obtient le jour de la date du jour
> set current_day to (day of ArbitraryCurrentDate as string)
>
> The whole script works fine. If I feed it "current date", it gives me "15.04.22" for today.
>
> (Apologize is there is a trivial way to do that though :)
>
> Now, when I copy that function from "on ConvertApplescriptDatetoString:ArbitraryCurrentDate" to "end ConvertApplescriptDatetoString:" and paste that bit at the end of a bigger script so that I have all my functions together, an attempt to save the new version of the script gives me:
>
> "Expected class name but found application constant or consideration"
>
> and highlights "string" as the culprit...
>
> I've tried to rewrite the script without using coercion to strings (which seems to be the only reason why I get this error) but there are places where I can't figure a way to do without them so I'm at a loss...
>
> Any idea what the problem is ?
Hello Jean-Christophe,
If I may allow, your post is quite difficult to read…
For such questions, the better way is probably to devise the smallest script example that reproduces the problem and to post that one; your list fellows then have something to crunch, not to guess. In addition, such a process often allows oneself to find the error.
So, you say to have a handler that works fine in isolation:
on ConvertApplescriptDatetoString:ArbitraryCurrentDate
# obtient le jour de la date du jour
set current_day to (day of ArbitraryCurrentDate as string)
# autres traitements
end ConvertApplescriptDatetoString:
(BTW, how do you invoke it?)
What additional statements do you have to add to above script for raising the error?
Axel
_______________________________________________
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