Messenger Plus! Live Forums » Messenger Plus! Live Extension » Scripting » Interface Writer | [release] 2.0 | 07/11/2009

Pages: (6): « First « 1 2 3 4 [ 5 ] 6 » Last » Reply 
Interface Writer | [release] 2.0 | 07/11/2009
Author: Message:
SmokingCookie
Senior Member
****

Avatar
(Soon to be) F-16 pilot =)

Posts: 629
Reputation: 12
15 / Male / Flag
Joined: Jul 2007
RE: RE: Interface Writer | [release] 1.2
quote:
Originally posted by whiz

Ok, let's see.

Javascript code:
var ControlsXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Controls/Control";
var ElementsXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Elements/Element";
/
ret.Interface[WindowId] = new Object();
ret.Interface[WindowId].Controls = new Object();
ret.Interface[WindowId].Elements = new Object();

1) Am I able to create my own, like this?  For example, to get the window title:
Javascript code:
var CaptionsXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Attributes/Caption";
var TitlesXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/TitleBar/Title/Text";

But...  it can't be enumerated:
Javascript code:
var K = new Enumerator(xml.selectNodes(CaptionsXPath));

It's different, because the value isn't "<Item Parameter="Value">", but "<Item>Value</Item>".  How can I get that?

Javascript code:
var K = new Enumerator(xml.selectNodes(ControlsXPath));
if(K.count() > 0) {
    for(; !K.atEnd(); K.moveNext()) {
        var ControlNode = K.item();
        var ControlId = ControlNode.getAttribute("Id");
        // Define an object for this control type (as in ButtonControl or StaticControl) that contains the actual control
        // Only done when necessary
        if(ControlId in ret.Interface[WindowId].Controls) {
            //[alert the user that there's 2 or more controls with the same ID]
            continue;
        }
        // You'll have to do your own stuff here
        ret.Interface[WindowId].Controls[ControlId] = "null" //[JScript control definition stuff]
    }
}

2a) If that gets a control ID, then I assume that getting the type uses the same method, replacing ".getAttribute("Id")" with ".getAttribute("xsi:type")", right?
2b) Would this work:
[code left out]

1) yes.
2) also yes, but instead of "ControlLeft" and "ControlId" variables, you may wanna use an object with these properties:

code:
var Control = new Object();
Control.Id = xmlNode.getAttribute("Id"); // xmlNode in this case is K.item();
Control.Type = xmlNode.getAttribute("xsi:type");
Control.Position = {
    "Left"    : xmlPosNode.getAttribute("Left"),
    "Top"    : xmlPosNode.getAttribute("Top"),
    "Width"    : xmlPosNode.getAttribute("Width"),
    "Height"    : xmlPosNode.getAttribute("Height") // Note that there's no comma on this one
}// Object definition, version 2

About the enumeration thingy: there's probably only one node, so enumeration would be useless with "var CaptionsXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Caption";" and such. You can retrieve the caption using the following code:

JScript code:
var CaptionXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Caption"
var node = xml.selectSingleNode(CaptionXPath);
var sCaption = node.text;


quote:
Originally posted by whiz
I apologise for so many questions, but this is a confusing topic for me...  :S

Never mind, I started with the same amount of questions :P

Oh and sorry for the late answer. Had no PC for over a week :S

This post was edited on 06-28-2009 at 07:20 AM by SmokingCookie.
I know it doesn't happen often, but IF I have been helpful, please click HERE

Video Converter Plus!

My webpage
06-28-2009 07:13 AM
Profile PM Web Find Quote Report
whiz
Full Member
***

Avatar
Currently... scripting.

Posts: 160
– / Male / Flag
Joined: Nov 2008
RE: Interface Writer | [release] 1.5
quote:
Originally posted by CookieRevised
ok, but it is way better to edit your first post and instead replace the old script with the new(est) version.
After that you can remove all the other attachments in your other posts, they aren't needed and people will still be able to download the wrong version.
(remember, not everybody reads an entire thread to know which version is which; mostly, if they see an attachment in a post (after they came directly to that post because they were referred to it fro manother thread), they probably think it is the latest version)...
Ok, done it.  :D



quote:
Originally posted by SmokingCookie
1) yes.
2) also yes, but instead of "ControlLeft" and "ControlId" variables, you may wanna use an object with these properties:

code:
var Control = new Object();
Control.Id = xmlNode.getAttribute("Id"); // xmlNode in this case is K.item();
Control.Type = xmlNode.getAttribute("xsi:type");
Control.Position = {
    "Left"    : xmlPosNode.getAttribute("Left"),
    "Top"    : xmlPosNode.getAttribute("Top"),
    "Width"    : xmlPosNode.getAttribute("Width"),
    "Height"    : xmlPosNode.getAttribute("Height") // Note that there's no comma on this one
}// Object definition, version 2

Hang on, if "xmlNode" is "K.item()", then what's "xmlPosNode"?

quote:
Originally posted by SmokingCookie
About the enumeration thingy: there's probably only one node, so enumeration would be useless with "var CaptionsXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Caption";" and such. You can retrieve the caption using the following code:

JScript code:
var CaptionXPath = "//Interfaces/Window[@Id=\"" + WindowId + "\"]/Caption"
var node = xml.selectSingleNode(CaptionXPath);
var sCaption = node.text;


1) You can use ".getAttribute()" to get a value from an "<element type="value"/>" tag, and ".selectSingleNode()" + "[node].text" to get a value from an "<element>value</element>" tag.  Is this right?
2) Can I use ".selectSingleNode()" and "[node].text" to get any text in XML written as "<element>value</element>"?
06-28-2009 09:30 AM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar
(Soon to be) F-16 pilot =)

Posts: 629
Reputation: 12
15 / Male / Flag
Joined: Jul 2007
RE: Interface Writer | [release] 1.5
xmlPosNode is xml.selectSingleNode("//Interfaces/Window[@Id=\"" + WindowId + "\"]/Controls/Control[@Id=\"" + ControlId + "\"]/Position");



1) Yes
2) yes (isn't that the same question as 1? :P )
I know it doesn't happen often, but IF I have been helpful, please click HERE

Video Converter Plus!

My webpage
06-28-2009 03:24 PM
Profile PM Web Find Quote Report
whiz
Full Member
***

Avatar
Currently... scripting.

Posts: 160
– / Male / Flag
Joined: Nov 2008
RE: Interface Writer | [release] 1.5
Right, I think I might actually understand it now...  I will keep working at it!

EDIT: Um...  I need more help.  :S
code:
Message in Script Debugger
XML document must have a top level element.
 at 0 (0)
What does that mean?  There's nothing wrong with the file...

This post was edited on 06-29-2009 at 07:13 PM by whiz.
06-29-2009 06:31 PM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar
(Soon to be) F-16 pilot =)

Posts: 629
Reputation: 12
15 / Male / Flag
Joined: Jul 2007
RE: Interface Writer | [release] 1.5
That's what the forums are for ;)
I know it doesn't happen often, but IF I have been helpful, please click HERE

Video Converter Plus!

My webpage
06-29-2009 07:12 PM
Profile PM Web Find Quote Report
mynetx
Skinning Contest Winner
Beta Tester
*****

Avatar
Windows Live Enhanced

Posts: 931
Reputation: 33
22 / Male / Flag
Joined: Jul 2007
RE: Interface Writer | [release] 1.5
quote:
Originally posted by whiz
What does that mean? 
Usually that refers to a missing root node, like <html> in HTML.
06-30-2009 07:31 AM
Profile PM Web Find Quote Report
whiz
Full Member
***

Avatar
Currently... scripting.

Posts: 160
– / Male / Flag
Joined: Nov 2008
RE: RE: Interface Writer | [release] 1.5
quote:
Originally posted by mynetx
Usually that refers to a missing root node, like <html> in HTML.
But as far as I know, there isn't anything missing.  Is it something to do with not using the Schema...  thing?
07-03-2009 06:25 PM
Profile E-Mail PM Web Find Quote Report
whiz
Full Member
***

Avatar
Currently... scripting.

Posts: 160
– / Male / Flag
Joined: Nov 2008
RE: Interface Writer | [release] 2.0 | 07/11/2009
Version 2.0 has been released!  :D  And now it loads files!  :D:D:D

Leave any comments or suggestions here!  ;)
11-07-2009 01:49 PM
Profile E-Mail PM Web Find Quote Report
mynetx
Skinning Contest Winner
Beta Tester
*****

Avatar
Windows Live Enhanced

Posts: 931
Reputation: 33
22 / Male / Flag
Joined: Jul 2007
RE: Interface Writer | [release] 2.0 | 07/11/2009
Whiz,

Great job you’ve done.  I have downloaded Interface Writer 2.0 and here are my suggestions on what you can make better :)  There is no particular order in my list.
  • Use a system dialog for opening and saving files. This allows easy selection of files without having to know their names.  You can find more information about Common Dialogs at MSDN.
    JScript code:
    cd = new ActiveXObject("MSComDlg.CommonDialog"); // create the object
    cd.Filter = "All Files(*.*)|*.*|JScript Files(*.js)|*.js"; // set file filter
    cd.FilterIndex = 2;
    cd.MaxFileSize = 128; // must set MaxFileSize. otherwise you will get an error´
    cd.ShowOpen(); // show it to user
    file = cd.FileName; // retrieve file + path
    if (!file) { // If the user does enter file exit
        MsgPlus.DisplayToast("", "You must enter a file name");
    }
    else {
        MsgPlus.DisplayToast("", "The user selected:\n" + file );
    }

  • Remove the help tooltip from the ListView listing all Controls/elements. The tooltip is needed for hovering ellipsed items in the grid.
  • Add support for Interface Tester to see the changes without having to create a test script.
  • Add support for custom attributes.
  • Add options dialog for various options, like "auto-save when I change a field" or "auto-create backup on opening a file" or "change indention style on generated XMLs".
  • Add a list of recently used files.
  • Add texts to the bottombar buttons. Always hovering them to guess their meaning is a bit strange.

So far for this list.  Don’t forget—what you’ve already done is amazing, just keep up the good work.

Best,
mynetx
11-07-2009 02:04 PM
Profile PM Web Find Quote Report
whiz
Full Member
***

Avatar
Currently... scripting.

Posts: 160
– / Male / Flag
Joined: Nov 2008
RE: Interface Writer | [release] 2.0 | 07/11/2009
quote:
Originally posted by mynetx
  • Use a system dialog for opening and saving files. This allows easy selection of files without having to know their names.  You can find more information about Common Dialogs at MSDN.
    JScript code:
    cd = new ActiveXObject("MSComDlg.CommonDialog"); // create the object
    cd.Filter = "All Files(*.*)|*.*|JScript Files(*.js)|*.js"; // set file filter
    cd.FilterIndex = 2;
    cd.MaxFileSize = 128; // must set MaxFileSize. otherwise you will get an error
    cd.ShowOpen(); // show it to user
    file = cd.FileName; // retrieve file + path
    if (!file) { // If the user does enter file exit
        MsgPlus.DisplayToast("", "You must enter a file name");
    }
    else {
        MsgPlus.DisplayToast("", "The user selected:\n" + file );
    }


I've just tested that, but it doesn't seem to work on initialization:
code:
From the Script Debugger
Script is starting
Error: unknown (code: -2147221230)
       File: FnInitialization.js. Line: 1.
Script has failed to start
Something wrong with the ActiveX object?



quote:
Originally posted by mynetx
  • Remove the help tooltip from the ListView listing all Controls/elements. The tooltip is needed for hovering ellipsed items in the grid.

Removed.  But what do you mean by "ellipsed items"?  Do you mean a tooltip for each window/control/element with extra details?



quote:
Originally posted by mynetx
  • Add support for Interface Tester to see the changes without having to create a test script.

Had just been thinking about that, but at the moment, I've done it so that the interface is saved as a temporary file, and then opened using MsgPlus::CreateWnd.



quote:
Originally posted by mynetx
  • Add support for custom attributes.

I'll work on this, but it would take a while to specify what attributes go with what in a list, so I'll probably let the user pick what attributes they want to use with a text area or something.



quote:
Originally posted by mynetx
  • Add options dialog for various options, like "auto-save when I change a field" or "auto-create backup on opening a file" or "change indention style on generated XMLs".
  • Add a list of recently used files.

They'll both need the registry functions, but I'll add them.  Eventually.



quote:
Originally posted by mynetx
  • Add texts to the bottombar buttons. Always hovering them to guess their meaning is a bit strange.

Fair enough.  ;)  Will do.
11-07-2009 02:32 PM
Profile E-Mail PM Web Find Quote Report
Pages: (6): « First « 1 2 3 4 [ 5 ] 6 » Last »
« Next Oldest Return to Top Next Newest »
Reply 


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On