Calling Applescript using the MacScript()-function in Excel 11 is sometimes driving me crazy:
My script is calling curl via shell (snowleopard), parses the requested xml and puts the values in my excelsheet. All works fine with the script stored in my documents-folder and called in Excel-VBA with the MacScript-Function:
result = MacScript("MyScript.scpt").
Now I won't deploy several files, so i stored the script in an excel-cell and called it like that:
Dim scriptToRun As String
' -- "MyScript" is a named Excel-Cell here
scriptToRun = Range("MyScript").Value
result = MacScript(scriptToRun)
with very simple scripts this works fine too, but there are problems:
with "on run...end run"-block the script is not executed. But how are functions defined without an on-run-block?
set file_tgt to (POSIX path of(path to temporary items)) & "my.xml" leads to runtime-error 5
"do shell script" leads to a runtime-error 5
All those commands are working well, when the script is saved as a file, but suck, when they are passed as a string. Does anyone know the reason for this strange behaviour? All suggestions (ecxept "burn down your mac") are welcome!
Xplain's use of MacNews, AppleCentral and AppleExpo are not affiliated with Apple, Inc. MacTech is a registered trademark of Xplain Corporation. AppleCentral, MacNews, Xplain, "The journal of Apple technology", Apple Expo, Explain It, MacDev, MacDev-1, THINK Reference, NetProfessional, MacTech Central, MacTech Domains, MacForge, and the MacTutorMan are trademarks or service marks of Xplain Corp. Sprocket is a registered trademark of eSprocket Corp. Other trademarks and copyrights appearing in this printing or software remain the property of their respective holders.
All contents are Copyright 1984-2010 by Xplain Corporation. All rights reserved. Theme designed by Icreon.