| Author |
Message |
kbkl24r
Joined: 13 Aug 2008 Posts: 2
|
| Posted: Wed Aug 13, 2008 - 1:24 am Post subject: "/main.js: Value undefined does not allow function call |
|
|
I am developing a widget that needs to launch a number of applications on the user's machine. Some of these applications have been developed using "normal" tools and other with Macromedia Director. This means that my JavaScripts cannot rely on always using "widget.openApplication(...)", but need to have another means to find and launch the user applications.
After looking into a variety of options, I settled on setting up an "osascript" call. Here is an example of the code:
var UserApp;
UserApp = "tell application \"Users Application\" to launch"
function launchUserApplication() {
if(window.widget) {
widget.system("/usr/bin/osascript -e '" + UserApp + "'", null);
}
}
I have made sure that the "AllowFullAccess" flag was set to <true/>.
With all of this, the widget runs great within Dashcode's testing environment, however, the problem occurs when the widget is deployed. This is when I get this error message:
".../main.js: Value undefined does not allow function calls. (line: 49)" [Note: Line 49 is the "widget.system" line in the above referenced code.]
I have tried re-writing the code to no avail. I have now invested many hours online trying to find a FAQ or other post addressing this problem. Again, no luck. Now I am at a loss as to what might be the cause of this.
Does anyone have any ideas? Has anyone experienced this? I can really use any guidance to work through this issue.
Thanks!
---
Dashcode Version 2.0 on 10.5.4. |
|
| |
|
| |
thewilson
Joined: 28 Aug 2008 Posts: 18
|
| Posted: Thu Aug 28, 2008 - 4:06 pm Post subject: |
|
|
Do you know the absolute path of the programs to be run? It seems you might have more success if you just run the program straight out of the widget.system call
MW
Did you find anything else out ??? |
|
| |
|
| |
kbkl24r
Joined: 13 Aug 2008 Posts: 2
|
| Posted: Fri Aug 29, 2008 - 6:27 am Post subject: |
|
|
I did try using absolute paths and the 'widget.system' call without success. The error message was the same.
An interesting observation is that the script works within a Yahoo widget's JavaScript. This leads me to believe that there is something within Dashboard that is blocking the script's call. I searched for information on this, however I never found any postings that talked about this theory.
Have you seen this before? |
|
| |
|
| |
thewilson
Joined: 28 Aug 2008 Posts: 18
|
| Posted: Fri Aug 29, 2008 - 4:37 pm Post subject: |
|
|
If your other calls to launch applications are working its weird to be getting that error. Have you tried maybe modifying the function name? Maybe its sharing a reserved word somewhere? Also you have to test this functionality inside of the widget environment since the widget object only exists there. I've got the undefined error trying to run a widget in safari. I would see what error text is coming out with your call
var error = widget.system("/usr/bin/id -un", null).errorString; |
|
| |
|
| |