tomhennigan
Joined: 14 Jan 2006 Posts: 2 Location: London, UK
|
Posted: Sun Jan 15, 2006 - 9:46 am Post subject: Help with javascript.... |
|
|
Hey guys, I would really appreciate it if someone would help me out here! I'm writing a dashboard widget fro the aMSN project, and I've come to a dead end. I've never done javascript before, and so I kinda expected this. I basically need to execute an applescript with a variable. I would love someone to point out where I've gone wrong! I've read the thread about executing the applescript with a variable and then using 'and item 1 of args' and I'm using that. I think it may be a problem with my javascript though. Here's my widget in it's current state please right click and click download linked file as my server doesn't allow hotlinking. Any help appreciated! |
|
tomhennigan
Joined: 14 Jan 2006 Posts: 2 Location: London, UK
|
Posted: Mon Jan 16, 2006 - 4:22 am Post subject: |
|
|
My code looks like this: Here's the javascript:
Code: | function usernameInput (event, input)
{
if (event.keyCode == 13) // enter or return
{
var cmd = "/usr/bin/osascript changeName.scpt " + input;
var obj = widget.system(cmd, null);
alert(obj.outputString);
}
} |
And the applescript looks like this:
Code: | on run args
tell application "aMSN"
set username to do script "::config::getKey login"
do script "::MSN::changeName " & username & " " & item 1 of args & " 0"
end tell
end run |
The applescript works fine when i execute it from the command line with an arguement, but for somereason doesn't work with the other script. |
|