Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Wine
➜ scripting - using ms jscript
scripting - using ms jscript
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Pompey1
(12 posts) Bio
|
Date
| Thu 27 Mar 2008 02:51 AM (UTC) Amended on Thu 27 Mar 2008 02:56 AM (UTC) by Pompey1
|
Message
| I have the following script to read a nowplaying text file generated by an amarok plugin. The file is created with the correct name and in the correct directory.
function ReadNowPlaying() {
var fname =
"c:\\program files\\mushclient\\worlds\\nowplaying.txt";
var fso = new ActiveXObject("Scripting.FileSystemObject");
var textStream = fso.OpenTextFile( fname, 1 );
while (!textStream.AtEndOfStream) {
var dataLine = textStream.ReadLine();
world.note(dataLine);
}
textStream.Close();
}
I've got the scripting dlls jscript.dll and scrrun.dll in the "/home/<username>/.wine/drive_c/windows/system/" directory.
The text file is being generated as: "/home/<username>/.wine/drive_c/program files/mushclient/worlds/nowplaying.txt"
I get an error message:
Error number: -2146827859
Event: Execution of line 1460 column 3
Description: Automation server can't create object
Called by: Immediate execution
when I try and invoke the script function with immediate execution, the line number points to the line "var fso = new ActiveXObject("Scripting.FileSystemObject");" but that line is copied straight out of the ms help file for the scripting host.
I'm guessing I need to tweak something to access this object under wine, can anyone suggest what I need to tweak?
Pompey1 | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 27 Mar 2008 04:46 AM (UTC) |
Message
| Personally I would script using Lua, which has a built-in interface to MUSHclient. All the other scripting languages use COM and are less reliable under Wine.
However if you insist on trying to use Jscript, try running MUSHclient without the /wine command-line option, if you are using it. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #2 on Thu 27 Mar 2008 10:28 PM (UTC) |
Message
| Lua also has wonderful IO for text files. I am not sure if you can get jscript working with ActiveX controls through Wine. Heck, I even have issues with ActiveX on XP at work several times a week. |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Pompey1
(12 posts) Bio
|
Date
| Reply #3 on Fri 28 Mar 2008 10:47 AM (UTC) |
Message
| Yes, the question now is whether I want to re-code 1400+ lines of script from javascript to lua just so I can spam my amarok nowplaying music track at other mud users. :)
Pompey1 | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #4 on Fri 28 Mar 2008 10:40 PM (UTC) |
Message
| You know, if you just want to do one specific thing in Lua, you can make a plugin. Each plugin can be written in a different language.
One technique is for your main script to send a command which the plugin picks up as an alias. For example:
- Main script does: world.Execute ("nowplaying foobar")
- Plugin has an alias matching: nowplaying *
- Plugin opens the file needed by the wildcard (eg. for foobar) and displays/sends the appropriate things
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Pompey1
(12 posts) Bio
|
Date
| Reply #5 on Sat 29 Mar 2008 02:30 PM (UTC) |
Message
| I tried that, but I'm having problems .... I decided to convert the whole script to lua - should be an interesting exercise.
Pompey1 | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
24,543 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top