简体   繁体   中英

How to get Firefox version number?

Trying to get Firefox version number, why is the line not copied from the dll file?

#RequireAdmin
$DLL = DllOpen("xul.dll")
$st = FileReadLine('C:\Program Files\Mozilla Firefox\xul.dll', 175055);   
$st2 = StringLeft($st, 80)
$st3 = StringRight($st2, 12);
FileWriteLine('1.txt', $st3)
DllClose($DLL)

Do I need to convert to UTF-8?

" Trying to get Firefox version number …"

Using cmdline output:

#include <AutoItConstants.au3>
#include <StringConstants.au3>

Global Const $g_sVersion = _FirefoxGetVersion('C:\Program Files\Mozilla Firefox\firefox.exe')
ConsoleWrite($g_sVersion & @CRLF)

Func _FirefoxGetVersion(Const $sPath)
    Local Const $sRgx = '([\d\.]+)', _
                $sCmd = StringFormat('%s /c "%s" -v | more', @ComSpec, $sPath)
    Local Const $iPID = Run($sCmd, '', @SW_HIDE, $STDOUT_CHILD)

    If Not $iPID Then Return ''

    ProcessWaitClose($iPID)

    Local Const $sStd = StdoutRead($iPID)
    Local Const $aRes = StringRegExp($sStd, $sRgx, $STR_REGEXPARRAYMATCH)

    StdioClose($iPID)

    Return $aRes[0]
EndFunc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM