Re: MS Excel 2004 XLL addin in xcode
Re: MS Excel 2004 XLL addin in xcode
- Subject: Re: MS Excel 2004 XLL addin in xcode
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 14 Aug 2006 09:01:05 -0700
- Thread-topic: MS Excel 2004 XLL addin in xcode
Title: Re: MS Excel 2004 XLL addin in xcode
Yes, I forgot to mention that you can just call a compiled script, but then I figured you'd discover that.
Now, the converse of MacScript ('do Visual basic' in AppleScript) cannot return results, but I was pretty sure that MacScript in VBA could return a result to VBA. But only when run as a string, I guess, not when calling an external compiled script. (If I remember correctly, that would be the same as the 'run script' command in AppleScript, which it probably emulates.)
So do what I do for 'do Visual Basic', but reversed: in your AppleScript, if the result you're looking for is a string, or something that can be coerced to a string (usually 'as string' will do it if it can), use the 'open for access with write permission', 'write' and 'close access' commands (see Standard Additions dictionary in Script Editor) to write the string result(s) to a file. Then in VBA, read it back with Input, and convert the string to whatever you need.
--
Paul Berkowitz
From: Jim McKinnon <email@hidden>
Date: Sun, 13 Aug 2006 22:09:21 -0700
To: <email@hidden>
Cc: Xcode Users List <email@hidden>
Subject: Re: MS Excel 2004 XLL addin in xcode
Paul,
Thanks for the info as that is a slick way of calling a script. I can just call the compiled script so I don't have to worry about the formatting.
However, I need to pass variables to the functions and get one or more back. Macscript does not seem to allow that.
I found a tech note from MS - and the scripting fails to run - figures. ;)
http://support.microsoft.com/kb/q184440/
I need to post in the scripting section I guess. Time to sign up.
Jim
On Aug 13, 2006, at 10:00 AM, Paul Berkowitz wrote:
On 8/13/06 9:36 AM, "Jim McKinnon" <email@hidden> wrote:
I think I need to create a custom function like normal using VBA that somehow calls applescript, then unix script, then fortran/c code! I am researching applescript from VBA - but I have not found anything yet.
In VBA is a function called MacScript, which can execute any AppleScript (as a string). Look it up in the VBA Help. Literal quoting gets tricky, but it can all be done. One thing to look out for: multiline AppleScripts need to be first fed into a subroutine that replaces line endings with ' & vbCr & ' (vbCr is a useful VBA shorthand for carriage returns, used as line endings in VBA). You can call the Unix commands using 'do shell script' scripting addition within the AppleScript (see Standard Additions dictionary in Script Editor), which can do anything Unix. Quoting will now get very tricky...
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Jim McKinnon
Research Engineer
Frontier Engineering
Phone: 805-577-8771
Fax: 805-577-1192
Email: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden