{"id":2714,"date":"2012-04-28T00:29:31","date_gmt":"2012-04-28T00:29:31","guid":{"rendered":"http:\/\/www.gubatron.com\/blog\/?p=2714"},"modified":"2012-04-28T00:29:31","modified_gmt":"2012-04-28T00:29:31","slug":"nsis-how-to-check-if-the-default-browser-is-chrome","status":"publish","type":"post","link":"https:\/\/www.gubatron.com\/blog\/nsis-how-to-check-if-the-default-browser-is-chrome\/","title":{"rendered":"NSIS: How to check if the default browser is Chrome"},"content":{"rendered":"<p>Reading the registry key won&#8217;t cut it. This does.<\/p>\n<p>[code]<br \/>\n; isDefaultBrowserChrome<br \/>\n!define isDefaultBrowserChrome &quot;!insertmacro isDefaultBrowserChrome&quot;<\/p>\n<p>!macro isDefaultBrowserChrome Result<\/p>\n<p>   FileOpen $0 &quot;$PLUGINSDIR\\browser_detect.htm&quot; &quot;w&quot;<br \/>\n   FileClose $0<br \/>\n   System::Call &quot;Shell32::FindExecutable(t &#8216;$PLUGINSDIR\\browser_detect.htm&#8217;, i 0, t .r1)&quot;<br \/>\n   ${StrLoc} $0 $1 &quot;chrome.exe&quot; &quot;&gt;&quot;<br \/>\n   ${If} $0 != &quot;&quot;<br \/>\n       StrCpy ${Result} &quot;1&quot;<br \/>\n   ${Else}<br \/>\n       StrCpy ${Result} &quot;0&quot;<br \/>\n   ${EndIf}<\/p>\n<p>!macroend<br \/>\n[\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Reading the registry key won&#8217;t cut it. This does. [code] ; isDefaultBrowserChrome !define isDefaultBrowserChrome &quot;!insertmacro isDefaultBrowserChrome&quot; !macro isDefaultBrowserChrome Result FileOpen $0 &quot;$PLUGINSDIR\\browser_detect.htm&quot; &quot;w&quot; FileClose $0 System::Call &quot;Shell32::FindExecutable(t &#8216;$PLUGINSDIR\\browser_detect.htm&#8217;, i 0, t .r1)&quot; ${StrLoc} $0 $1 &quot;chrome.exe&quot; &quot;&gt;&quot; ${If} $0 != &quot;&quot; StrCpy ${Result} &quot;1&quot; ${Else} StrCpy ${Result} &quot;0&quot; ${EndIf} !macroend [\/code]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[1437,724,1108],"class_list":["post-2714","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-code","tag-nsis","tag-windows"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5Unzf-HM","jetpack-related-posts":[{"id":2197,"url":"https:\/\/www.gubatron.com\/blog\/nsis-charat-function-macro\/","url_meta":{"origin":2714,"position":0},"title":"NSIS CharAt Macro","author":"gubatron","date":"March 21, 2011","format":false,"excerpt":"Lord knows why the NSIS folks didn't add a CharAt function to their API. In case you need it to parse a string, here's a Macro that makes StrCpy work like a CharAt function [bash] ;Get a character inside a string given an index. ;Usage: CharAt String Index Output !macro\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2267,"url":"https:\/\/www.gubatron.com\/blog\/nsis-strcontains-function-find-the-index-of-a-sub-string\/","url_meta":{"origin":2714,"position":1},"title":"NSIS: StrContains function &#8211; Find the index of a sub string.","author":"gubatron","date":"August 31, 2011","format":false,"excerpt":"Recently I was out of internet and I needed to implement a function that would search if a String was part of another String for an NSIS installer. Here's my rendition of such a function. Once I came back online I found out about StrStr, but here's another option that\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1928,"url":"https:\/\/www.gubatron.com\/blog\/droid-vs-nexus-1-who-can-calculate-md5-faster\/","url_meta":{"origin":2714,"position":2},"title":"Droid vs Nexus 1: Who can calculate MD5 faster?","author":"gubatron","date":"May 21, 2010","format":false,"excerpt":"Nexus 1 indeed. 17 files get their MD5 calculated on the Droid and 17 files get their MD5 hash calculated on the Nexus 1 Nexus 1 pwns. Here's the code in case you're curious. [java] public void onClick(View v) { _logTextView.setText(\"MD5 Benchmark on \" + Build.DEVICE + \"nn\"); if (GlobalVariables.APP_CONTEXT\u2026","rel":"","context":"In &quot;Android&quot;","block_context":{"text":"Android","link":"https:\/\/www.gubatron.com\/blog\/category\/android\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2926,"url":"https:\/\/www.gubatron.com\/blog\/how-to-check-if-a-java-process-is-running-on-any-local-virtual-machine-programatically\/","url_meta":{"origin":2714,"position":3},"title":"How to check if a Java Process is running on any local Virtual Machine programmatically","author":"gubatron","date":"January 30, 2013","format":false,"excerpt":"Quick and dirty way to check if a Java Process is already running. Useful if you need to run cronjobs periodically and you don't know how long they might take, you can add this check at the beginning of your main, and it'll look for all the local virtual machines\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2632,"url":"https:\/\/www.gubatron.com\/blog\/javascript-get-n-random-elements-from-a-list\/","url_meta":{"origin":2714,"position":4},"title":"javascript: Get N random elements from a List","author":"gubatron","date":"January 5, 2012","format":false,"excerpt":"[javascript] \/** * Walks linearly through the list to find an element. * returns true if it's found. *\/ function elementIn(collection, element) { for (var i=0; i < collection.length; i++) { if (collection[i]==element) { return true; } } return false; } \/** * Returns a new list of n random\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2193,"url":"https:\/\/www.gubatron.com\/blog\/get-a-randomly-weighted-key-in-a-mapdictionaryassociative-array\/","url_meta":{"origin":2714,"position":5},"title":"Get a randomly weighted key in a Map\/Dictionary\/Associative Array","author":"gubatron","date":"March 15, 2011","format":false,"excerpt":"Here's a very useful function to retrieve a randomly weighted key from an associative array in PHP. Sometimes you need to fetch random elements from a collection but you need some elements to have a little more chance than others to be fetched (business rules or whatever...) [php] srand(time()); \/\/dont\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/2714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/comments?post=2714"}],"version-history":[{"count":2,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/2714\/revisions"}],"predecessor-version":[{"id":2723,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/2714\/revisions\/2723"}],"wp:attachment":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/media?parent=2714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/categories?post=2714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/tags?post=2714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}