Interface Writer | [release] 3.0 | 22/08/2010 |
Author: |
Message: |
whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
O.P. Interface Writer | [release] 3.0 | 22/08/2010
Features
- basically, it writes windows for you
- can be saved as an XML file, or a copy/paste compatible source code
- load existing interfaces and edit them
- import, save as and save copy functions for interface files
- unlimited windows, controls and elements
- graphically build windows with the simple builder tool
- view interface files without needing the editor
- user-friendly - just double-click to add or edit windows, controls or elements
- full validation of file paths, window IDs and control IDs
New in this Version
- added: bottom bar support (including placing controls in them)
- added: comments for controls/elements
- added: controls/elements can have negative positions
- added: custom double-click action for window manager
- added: load/save options for evaluator (debug)
- added: multiple control/element editors
- added: preset manager - add/insert/remove presets from one place
- added: recovery options (backups saved when changes are made)
- added: sort windows, controls or elements alphabetically on demand
- added: status bar - information on add/edit/remove actions, saving, etc.
- added: support for Interface Tester application
- changed: dialog and debugging classes have been rewritten for stability
- changed: help guide covers window, control and element managers globally
- changed: new windows with existing IDs prompts to overwrite
- fixed: controls and elements are lost after windows are renamed
- fixed: controls and elements cannot be added to renamed windows
- fixed: debug options don't disable properly
- fixed: recent files list only displays one item
- fixed: editing a pasted window (with original intact) edits both simultaneously
- fixed: selection button remains enabled after certain actions
- fixed: window, control and element managers refused to cancel renaming
Screenshot (click to enlarge)
To-do List
- control enabled/visible options - won't be too hard, just not got round to it yet
- multiple items on the clipboard (currently, one window, control and element maximum)
- control/element builder (not sure how to do - want to be able to "draw" onto a window)
- support for bottom bar controls (when enabled in a window)
- sidebar on window manager - possibly with a child window
Download Options
Attachment: Interface Writer.plsc (165.96 KB)
This file has been downloaded 398 time(s).
This post was edited on 08-22-2010 at 03:26 PM by whiz.
|
|
05-25-2009 02:55 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: BETA - Interface Writer 1.0!
FnSaveMethods.js:
function SaveInterface() {}
js code: var TextFile = FileSO.OpenTextFile(FilePath, 2);
Should be:
js code: var TextFile = FileSO.OpenTextFile(FilePath, 2, true, -1 /*UNICODE*/);
|
|
05-25-2009 03:16 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: BETA - Interface Writer 1.0!
quote: Originally posted by whiz
Known Issues
no validation of numbers (for example, it will allow "text" as a valid height measurement)
no validation of matching ID's (for example, two controls with the name "EdtTest")
If you need help with these, PM me and I will help
<Eljay> "Problems encountered: shit blew up"
|
|
05-25-2009 03:26 PM |
|
|
whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
O.P. RE: Interface Writer | [beta] 1.0
quote: Originally posted by matty
FnSaveMethods.js:
function SaveInterface() {}
js code: var TextFile = FileSO.OpenTextFile(FilePath, 2);
Should be:
js code: var TextFile = FileSO.OpenTextFile(FilePath, 2, true, -1 /*UNICODE*/);
Thanks for that. I've fixed it, and I'll re-upload it in a moment...
quote: Originally posted by Spunky
quote: Originally posted by whiz
Known Issues
no validation of numbers (for example, it will allow "text" as a valid height measurement)
no validation of matching ID's (for example, two controls with the name "EdtTest")
If you need help with these, PM me and I will help
I can probably do the first one, but I'm not sure about the second. Would something like this work:
js code: for (var X in WndLstId)
{
if (!objWnd.GetControlText("EdtId") == WndLstId[X])
{
// save code here...
}
}
EDIT: actually, I've changed my mind. I don't think I can do the first one either.
This post was edited on 06-14-2009 at 02:29 PM by whiz.
|
|
05-25-2009 03:31 PM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: BETA - Interface Writer 1.0!
Those issues aren't that hard to solve!
- Validation of numbers (for example, it will allow "text" as a valid height measurement)
js code: var sFoo = "85.1";
var nFoo = 1 * sFoo; //Attempt a string to number conversion
if( isNaN(nFoo) ) nFoo = 0; //Failed, set to some default value or ignore the declaration
- Validation of matching IDs (for example, two controls with the name "EdtTest")
js code: var sTestId = "BtnTest"; //Control ID to test
var bIsUniqueId = true; //Boolean to hold the result
for( var i in WndLstId ) { //Loop through the control IDs
if( WndLstId[i] == sTestId ) { //Check if this control ID matches the test ID
//We have a match!
bIsUniqueId = false; //Set the result to false
break; //End the loop (we know it's not unique now)
}
}
//Now make use of bIsUniqueId for further processing
|
|
05-25-2009 04:02 PM |
|
|
Spunky
Former Super Mod
Posts: 3658 Reputation: 61
36 / /
Joined: Aug 2006
|
RE: BETA - Interface Writer 1.0!
quote: Originally posted by Matti
Those issues aren't that hard to solve!
- Validation of numbers (for example, it will allow "text" as a valid height measurement)
js code: var sFoo = "85.1";
var nFoo = 1 * sFoo; //Attempt a string to number conversion
if( isNaN(nFoo) ) nFoo = 0; //Failed, set to some default value or ignore the declaration
- Validation of matching IDs (for example, two controls with the name "EdtTest")
js code: var sTestId = "BtnTest"; //Control ID to test
var bIsUniqueId = true; //Boolean to hold the result
for( var i in WndLstId ) { //Loop through the control IDs
if( WndLstId[i] == sTestId ) { //Check if this control ID matches the test ID
//We have a match!
bIsUniqueId = false; //Set the result to false
break; //End the loop (we know it's not unique now)
}
}
//Now make use of bIsUniqueId for further processing
Has already sent a PM, but both solutions are very similar to mine so I feel a bit better now
<Eljay> "Problems encountered: shit blew up"
|
|
05-25-2009 04:07 PM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: BETA - Interface Writer 1.0!
quote: Originally posted by Spunky
Has already sent a PM, but both solutions are very similar to mine so I feel a bit better now
Hah, great minds think alike!
|
|
05-25-2009 04:11 PM |
|
|
whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
O.P. RE: Interface Writer | [beta] 1.0
The "Add Window/Control" validators work fine, but the "Change Window/Control" validators don't seem to recognise if the ID matches another window/control's ID - even though those bits use the same validation method...
js code: // works fine :)
function OnWndWriterAddWndEvent_EditTextChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtTitle") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "")
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
for (var X in WndLstId)
{
if (WndLstId.length > 0 && objWnd.GetControlText("EdtId") == WndLstId[X])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
}
}
}
}
}
// gets it wrong :(
function OnWndWriterChangeWndEvent_EditTextChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtTitle") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "")
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
for (var X in WndLstId)
{
if (WndLstId.length > 1 && objWnd.GetControlText("EdtId") == WndLstId[X])
{
if (objWnd.GetControlText("EdtId") == WndLstId[WndLstTStSel])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
}
}
}
}
// works fine :)
function OnWndWriterAddControlEvent_EditTextChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtLeft") == "" || objWnd.GetControlText("EdtDown") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "" || objWnd.Combo_GetCurSel("CmbType") == -1 || objWnd.Combo_GetCurSel("CmbType") == 0)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtLeft") * 1) == true || isNaN (objWnd.GetControlText("EdtDown") * 1) == true || isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
for (var X in WndCtrlId[WndLstTStSel])
{
if (WndCtrlId[WndLstTStSel].length > 0 && objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][X])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
}
}
}
}
}
// works fine :)
function OnWndWriterAddControlEvent_ComboSelChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtLeft") == "" || objWnd.GetControlText("EdtDown") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "" || objWnd.Combo_GetCurSel("CmbType") == -1 || objWnd.Combo_GetCurSel("CmbType") == 0)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtLeft") * 1) == true || isNaN (objWnd.GetControlText("EdtDown") * 1) == true || isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
for (var X in WndCtrlId[WndLstTStSel])
{
if (WndCtrlId[WndLstTStSel].length > 0 && objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][X])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 1);
}
}
}
}
}
// gets it wrong :(
function OnWndWriterChangeControlEvent_EditTextChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtLeft") == "" || objWnd.GetControlText("EdtDown") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "" || objWnd.Combo_GetCurSel("CmbType") == -1 || objWnd.Combo_GetCurSel("CmbType") == 0)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtLeft") * 1) == true || isNaN (objWnd.GetControlText("EdtDown") * 1) == true || isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
for (var X in WndCtrlId[WndLstTStSel])
{
if (WndCtrlId[WndLstTStSel].length > 1 && objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][X])
{
if (objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][WndCtrlTStSel])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
}
}
}
}
// gets it wrong :(
function OnWndWriterChangeControlEvent_ComboSelChanged(objWnd, strControlId)
{
if (objWnd.GetControlText("EdtId") == "" || objWnd.GetControlText("EdtLeft") == "" || objWnd.GetControlText("EdtDown") == "" || objWnd.GetControlText("EdtWidth") == "" || objWnd.GetControlText("EdtHeight") == "" || objWnd.Combo_GetCurSel("CmbType") == -1 || objWnd.Combo_GetCurSel("CmbType") == 0)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
if (isNaN (objWnd.GetControlText("EdtLeft") * 1) == true || isNaN (objWnd.GetControlText("EdtDown") * 1) == true || isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
for (var X in WndCtrlId[WndLstTStSel])
{
if (WndCtrlId[WndLstTStSel].length > 1 && objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][X])
{
if (objWnd.GetControlText("EdtId") == WndCtrlId[WndLstTStSel][WndCtrlTStSel])
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 0);
}
}
else
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), 1);
}
}
}
}
}
This post was edited on 06-14-2009 at 02:30 PM by whiz.
|
|
05-25-2009 05:15 PM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: BETA - Interface Writer 1.0!
Well, you're not implementing our sample code properly.
You shouldn't re-enable the control when one item in the loop doesn't match the ID to test simply because you won't have all used IDs matching that one ID, you have to check whether there is at least one match.
js code: if (isNaN (objWnd.GetControlText("EdtLeft") * 1) == true || isNaN (objWnd.GetControlText("EdtDown") * 1) == true || isNaN (objWnd.GetControlText("EdtWidth") * 1) == true || isNaN (objWnd.GetControlText("EdtHeight")) == true)
{
Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnAdd"), 0);
}
else
{
>>> var bCanChange = true;<<<
>>> var sEdtId = objWnd.GetControlText("EdtId");<<<
for (var X in WndLstId)
{
>>> if (WndLstId.length > 1 && sEdtId == WndLstId[X] && X == WndLstTStSel)<<<
{
>>> bCanChange = false;<<<
>>> break;<<<
}
}
}
>>> Interop.Call("user32", "EnableWindow", objWnd.GetControlHandle("BtnChange"), bCanChange);<<<
}
As you can see, you don't need an else-block anywhere, you simply check three things:
- Check whether there are IDs in the array.
- Check whether the currently chosen test ID matches the key name of the current item in the loop.
- Check whether this item is currently being edited.
When these three conditions are fulfilled for one item in the loop, we can say that the chosen ID is not unique and thus bCanChange has to be set to false in order to disable the edit button.
When these conditions are never fulfilled, bCanChange will never change from its original value (true) and the button will be enabled.
Oh, on a side note: try to store some of the GetControlText calls in a variable inside your functions when you use them very often. It's good practice to take off the load of the API to get the control text every time and simply retrieve the value from a variable - the control text won't change anyway while executing the event function (and you don't want it to change either).
|
|
05-25-2009 05:41 PM |
|
|
vaccination
Veteran Member
Posts: 2513 Reputation: 43
32 / / –
Joined: Apr 2005
|
RE: BETA - Interface Writer 1.0!
...so no one's noticed that it fails at the first hurdle yet?
Script fails to create xml files.
code: <-- Start file creation. -->
> Attempting to create file "C:\Users\vaccination\Desktop\Windows.xml"...
Error: Object expected (code: -2146823281)
File: WndWriterCreateFile.js. Line: 70.
Function OnWndWriterCreateFileEvent_CtrlClicked returned an error. Code: -2147352567
Line 70 =
jscript code: else if (FileC(objWnd.GetControlText("EdtPath") + "\\" + objWnd.GetControlText("EdtName") + ".xml", true))
..FileC doesn't exist...
----
Also, might want to read the corect folder from the registry, or at least use MsgPlus.ScriptFilesPath instead of just assuming it's "\Program Files\Plus!.." because it isn't always, for instance, on x64 machines.
There's a lot of other improvements you could make too, for instance instead of writing the xml to a text file and manually adding all the nodes with TextFile.WriteLine like you are, try using the XML DOM instead.
You should also include a preview feature to make the script actually useful, and should be relatively easy to add in.
Oh and you've used a few Plus! resources in your script - such as imgfind, imgsave, imgcode etc - and still included the files in the package, you could just call the resources directly from Plus!.
This post was edited on 05-25-2009 at 05:42 PM by vaccination.
|
|
05-25-2009 05:41 PM |
|
|
Pages: (14):
« First
[ 1 ]
2
3
4
5
»
Last »
|
|
|