diff --git a/source/Stash_Helper.au3 b/source/Stash_Helper.au3 index 8d258e8..ed52999 100644 --- a/source/Stash_Helper.au3 +++ b/source/Stash_Helper.au3 @@ -50,7 +50,7 @@ DllCall("User32.dll","bool","SetProcessDPIAware") ; This version only compatible with Stash v17 and above. -Global Const $currentVersion = "v2.4.2" +Global Const $currentVersion = "v2.4.3" Global Const $gsRegBase = "HKEY_CURRENT_USER\Software\Stash_Helper" @@ -940,12 +940,12 @@ Func JsonEscape( $str ) EndFunc Func StartBrowser() - Switch $stashBrowser - Case "Firefox" + Switch StringLower($stashBrowser) + Case "firefox" SetupFirefox() - Case "Chrome" + Case "chrome" SetupChrome() - Case "Edge" + Case "edge" SetupEdge() Case Else $stashBrowser = "Edge" @@ -2321,14 +2321,19 @@ Func SetupChrome() If $gsBrowserLocation <> "" Then $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, ' _ & '"binary":"' & StringReplace($gsBrowserLocation, "\", "\\") & '", ' _ - & '"excludeSwitches": [ "enable-automation"], "args":["--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Default"]}}}}' + & '"excludeSwitches": [ "enable-automation"], "args":["--user-data-dir=' & GetDefaultChromeProfile() & '", "--profile-directory=Default"]}}}}' Else - $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "args":["--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Default"]}}}}' + $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "args":["--user-data-dir=' & GetDefaultChromeProfile() & '", "--profile-directory=Default"]}}}}' EndIf EndSwitch EndFunc ;==>SetupChrome +Func GetDefaultChromeProfile() + ; return like "C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\User Data\\" + return StringReplace( StringReplace( @AppDataDir, "\Roaming", "\Local") , "\", "\\" ) & "\\Google\\Chrome\\User Data\\" +EndFunc + Func SetupEdge() If Not FileExists(@AppDataDir & "\Webdriver\" & "msedgedriver.exe") Then Local $b64 = ( @CPUArch = "X64" ) @@ -2346,14 +2351,20 @@ Func SetupEdge() _WD_Option('DriverClose', True) _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @AppDataDir & "\Webdriver\msedge.log") + ; Edge cannot specified an exe location. Switch $stashBrowserProfile Case "Private" $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"excludeSwitches": [ "enable-automation"]}}}}' Case "Default" - $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"excludeSwitches": [ "enable-automation"], "args": ["user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Microsoft\\Edge\\User Data\\", "profile-directory=Default"]}}}}' + $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"excludeSwitches": [ "enable-automation"], "args": ["user-data-dir='& GetDefaultEdgeProfile() & '", "profile-directory=Default"]}}}}' EndSwitch EndFunc ;==>SetupEdge +Func GetDefaultEdgeProfile() + ; C:\\Users\\user\\AppData\\Local\\Microsoft\\Edge\\User Data\\ + Return StringReplace( StringReplace( @AppDataDir, "\Roaming", "\Local") , "\", "\\" ) & "\\Microsoft\\Edge\\User Data\\" +EndFunc + Func BrowserError($code, $sLine) MsgBox(48,"Oops !","Something wrong with the browser's driver. Cannot continue." _ & @CRLF & "WinHTTP status code:" & $code & @CRLF & "Script Line:" & $sLine) diff --git a/source/Stash_Helper.isn b/source/Stash_Helper.isn index d2608d9..4b78925 100644 Binary files a/source/Stash_Helper.isn and b/source/Stash_Helper.isn differ diff --git a/source/release/Stash_Helper.a3x b/source/release/Stash_Helper.a3x index 83d2f6a..f664ec0 100644 Binary files a/source/release/Stash_Helper.a3x and b/source/release/Stash_Helper.a3x differ diff --git a/source/release/Stash_Helper_Setup_v2.4.2.exe b/source/release/Stash_Helper_Setup_v2.4.3.exe similarity index 57% rename from source/release/Stash_Helper_Setup_v2.4.2.exe rename to source/release/Stash_Helper_Setup_v2.4.3.exe index 4c1ae26..f2fbdd7 100644 Binary files a/source/release/Stash_Helper_Setup_v2.4.2.exe and b/source/release/Stash_Helper_Setup_v2.4.3.exe differ