diff --git a/src/org/synthuse/SynthuseDlg.java b/src/org/synthuse/SynthuseDlg.java index a770332..e5fa76f 100644 --- a/src/org/synthuse/SynthuseDlg.java +++ b/src/org/synthuse/SynthuseDlg.java @@ -71,7 +71,7 @@ public class SynthuseDlg extends JFrame { /** * */ - public static String VERSION_STR = "1.0.9"; + public static String VERSION_STR = "1.1.0"; public static String RES_STR_MAIN_ICON = "/org/synthuse/img/gnome-robots.png"; public static String RES_STR_REFRESH_IMG = "/org/synthuse/img/rapidsvn.png"; diff --git a/src/org/synthuse/WindowsEnumeratedXml.java b/src/org/synthuse/WindowsEnumeratedXml.java index 92b0dfa..e86b786 100644 --- a/src/org/synthuse/WindowsEnumeratedXml.java +++ b/src/org/synthuse/WindowsEnumeratedXml.java @@ -138,8 +138,10 @@ public class WindowsEnumeratedXml implements Runnable{ Element win = null; if (w.framework.equals("win32")) win = doc.createElement("win"); - else + else if (w.framework.equals("WPF")) win = doc.createElement("wpf"); + else if (w.framework.equals("Silverlight")) + win = doc.createElement("silver"); win.setAttribute("hwnd", w.hwndStr); win.setAttribute("text", w.text); if (w.value != "" && w.value != null) diff --git a/src/org/synthuse/XpathManager.java b/src/org/synthuse/XpathManager.java index 29418e3..1b00835 100644 --- a/src/org/synthuse/XpathManager.java +++ b/src/org/synthuse/XpathManager.java @@ -95,7 +95,7 @@ public class XpathManager implements Runnable{ if (!winValueOrig.isEmpty()) //if value attribute exists then use it too valueStr = " and starts-with(@value,'" + compareLongTextString(winValueOrig) + "')"; - builtXpath = "//wpf[@class='" + classStr + "' and starts-with(@text,'" + txtStr + "')" + valueStr + "]"; + builtXpath = "//*[@class='" + classStr + "' and starts-with(@text,'" + txtStr + "')" + valueStr + "]"; //builtXpath = "//*[@hwnd='" + runtimeId + "']"; //System.out.println("evaluateXpathGetValues: " + builtXpath); diff --git a/src/org/synthuse/commands/BaseCommand.java b/src/org/synthuse/commands/BaseCommand.java index 9d74682..bf25ab5 100644 --- a/src/org/synthuse/commands/BaseCommand.java +++ b/src/org/synthuse/commands/BaseCommand.java @@ -116,15 +116,16 @@ public class BaseCommand { resultStr = item; break; } - if (WinPtr.isWpfRuntimeIdFormat(resultStr)) + if (WinPtr.isWpfRuntimeIdFormat(resultStr)) { result.runtimeId = resultStr; + if (!ignoreFailedFind && result.isEmpty()) + appendError("Error: Failed to find window handle matching: " + xpath); + } else { result.hWnd = Api.GetHandleFromString(resultStr); - if (!api.user32.IsWindow(result.hWnd)) - appendError("Error: Failed to located HWND(" + resultStr + ") from : " + xpath); + if (!ignoreFailedFind && !api.user32.IsWindow(result.hWnd)) + appendError("Error: Failed to locate window HWND(" + resultStr + ") from : " + xpath); } - if (result.isEmpty()) - appendError("Error: Failed to find window handle matching: " + xpath); return result; } diff --git a/src/org/synthuse/test/Silverlight.js b/src/org/synthuse/test/Silverlight.js new file mode 100644 index 0000000..80ff397 --- /dev/null +++ b/src/org/synthuse/test/Silverlight.js @@ -0,0 +1,2 @@ +//v2.0.30511.0 +if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.__onSilverlightInstalledCalled=false;Silverlight.fwlinkRoot="http://go2.microsoft.com/fwlink/?LinkID=";Silverlight.__installationEventFired=false;Silverlight.onGetSilverlight=null;Silverlight.onSilverlightInstalled=function(){window.location.reload(false)};Silverlight.isInstalled=function(b){if(b==undefined)b=null;var a=false,m=null;try{var i=null,j=false;if(window.ActiveXObject)try{i=new ActiveXObject("AgControl.AgControl");if(b===null)a=true;else if(i.IsVersionSupported(b))a=true;i=null}catch(l){j=true}else j=true;if(j){var k=navigator.plugins["Silverlight Plug-In"];if(k)if(b===null)a=true;else{var h=k.description;if(h==="1.0.30226.2")h="2.0.30226.2";var c=h.split(".");while(c.length>3)c.pop();while(c.length<4)c.push(0);var e=b.split(".");while(e.length>4)e.pop();var d,g,f=0;do{d=parseInt(e[f]);g=parseInt(c[f]);f++}while(f");delete a.id;delete a.width;delete a.height;for(var c in a)if(a[c])b.push('');b.push("");return b.join("")};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(b){var a="",d=Silverlight.fwlinkRoot,c=b.version;if(b.alt)a=b.alt;else{if(!c)c="";a="Get Microsoft Silverlight";a=a.replace("{1}",c);a=a.replace("{2}",d+"108181")}return a};Silverlight.getSilverlight=function(e){if(Silverlight.onGetSilverlight)Silverlight.onGetSilverlight();var b="",a=String(e).split(".");if(a.length>1){var c=parseInt(a[0]);if(isNaN(c)||c<2)b="1.0";else b=a[0]+"."+a[1]}var d="";if(b.match(/^\d+\056\d+$/))d="&v="+b;Silverlight.followFWLink("149156"+d)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+"&#"+a+";"}return b};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+" \n";a+="Message: "+b.ErrorMessage+" \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+" \n";a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}a+="MethodName: "+b.methodName+" \n"}alert(a)};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--)window["__slEvent"+a]=null;Silverlight._silverlightCount=0;if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.__getHandlerName=function(b){var a="";if(typeof b=="string")a=b;else if(typeof b=="function"){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var c=Silverlight._silverlightCount++;a="__slEvent"+c;window[a]=b}else a=null;return a};Silverlight.onRequiredVersionAvailable=function(){};Silverlight.onRestartRequired=function(){};Silverlight.onUpgradeRequired=function(){};Silverlight.onInstallRequired=function(){};Silverlight.IsVersionAvailableOnError=function(d,a){var b=false;try{if(a.ErrorCode==8001&&!Silverlight.__installationEventFired){Silverlight.onUpgradeRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==8002&&!Silverlight.__installationEventFired){Silverlight.onRestartRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==5014||a.ErrorCode==2106){if(Silverlight.__verifySilverlight2UpgradeSuccess(a.getHost()))b=true}else b=true}catch(c){}return b};Silverlight.IsVersionAvailableOnLoad=function(b){var a=false;try{if(Silverlight.__verifySilverlight2UpgradeSuccess(b.getHost()))a=true}catch(c){}return a};Silverlight.__verifySilverlight2UpgradeSuccess=function(d){var c=false,b="2.0.31005",a=null;try{if(d.IsVersionSupported(b+".99")){a=Silverlight.onRequiredVersionAvailable;c=true}else if(d.IsVersionSupported(b+".0"))a=Silverlight.onRestartRequired;else a=Silverlight.onUpgradeRequired;if(a&&!Silverlight.__installationEventFired){a();Silverlight.__installationEventFired=true}}catch(e){}return c} \ No newline at end of file diff --git a/src/org/synthuse/test/SilverlightMockTestApp.xap b/src/org/synthuse/test/SilverlightMockTestApp.xap new file mode 100644 index 0000000..0d37c77 Binary files /dev/null and b/src/org/synthuse/test/SilverlightMockTestApp.xap differ diff --git a/src/org/synthuse/test/SilverlightMockTestAppTestPage.html b/src/org/synthuse/test/SilverlightMockTestAppTestPage.html new file mode 100644 index 0000000..ed16466 --- /dev/null +++ b/src/org/synthuse/test/SilverlightMockTestAppTestPage.html @@ -0,0 +1,73 @@ + + + + + SilverlightMockTestApp + + + + + +
+
+ + + + + + + + Get Microsoft Silverlight + +
+
+ + diff --git a/src/org/synthuse/test/WpfMockTestApp.exe b/src/org/synthuse/test/WpfMockTestApp.exe new file mode 100644 index 0000000..05b1150 Binary files /dev/null and b/src/org/synthuse/test/WpfMockTestApp.exe differ