Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Allows user to retrieve Quickbooks licensing information in a human-readable format
- ;Works on a live system (system with QB installed) or from an offline drive from another
- ;system, or just the qbregistration.dat file itself.
- regexp_version := "<VERSION number=""""(.+?)"""">"
- regexp_flavor := "<FLAVOR name=""""(.+?)"""">"
- regexp_installID := "<InstallID>(.+?)<\/InstallID>"
- regexp_license := "<LicenseNumber>(.+?)<\/LicenseNumber>"
- ;Quickbooks version list
- pro := "Pro "
- bel := "Enterprise Solutions "
- superpro := "Premier "
- accountant := "Premier Accountant Edition "
- belacct := "Enterprise Accountant Edition "
- ;turn the version number (ie, 26.0) into the year (2016). Holds up for every
- ;version up until 2017, which is current at the time of writing.
- qbyear(year)
- {
- return Floor(2000 + year - 10)
- }
- ;end list
- ;Get a list of valid drive letters attached to this system
- DriveGet, drive_list, List
- ;Cycle through the drive letter list and discard drive letters that have not
- ;drive attached to them
- dl_pos := 1
- drive_list_actual := ""
- while (dl_pos < strlen(drive_list)) {
- this_letter := SubStr(drive_list, dl_pos, 1)
- DriveGet, this_capacity, Capacity, %this_letter%:\
- if (this_capacity)
- drive_list_actual := drive_list_actual . this_letter . "|"
- dl_pos++
- }
- drive_list_actual_len := StrLen(drive_list_actual)
- drive_list_actual := SubStr(drive_list_actual, 1, drive_list_actual_len-1)
- ;Create and show the GUI
- Gui, -Border +Caption -MinimizeBox -MaximizeBox -OwnDialogs -Resize +SysMenu +Theme -ToolWindow
- Gui, Add, Text, x10 y10 w460 h80, Tool to retrieve QuickBooks product information from a qbregistration.dat file. Choose a drive letter from the dropdown menu and let the program try to find the registration file`, or specify an absolute path to the file in the textbox below.
- Gui, Add, GroupBox, x10 y100 w450 h100, Select file location
- Gui, Add, Radio, x20 y130 w150 h20 checked vguichoice gGuiChangeChoice, Find file on selected drive:
- Gui, Add, Radio, x20 y170 w150 h20 gGuiChangeChoice, Specify file location:
- Gui, Add, DropDownList, x180 y130 w90 h20 R5 vdrive_letter, %drive_list_actual%
- Gui, Add, Edit, x180 y170 w150 h20 -Multi vfilePath Disabled,
- Gui, Add, Button, x340 y170 w100 h20 vbrowseButton gBrowse Disabled, Browse
- Gui, Add, Button, x360 y210 w100 h30 gRetrieve, OK
- Gui, Show, Center w475 h246, QB Registration Puller
- return
- Browse:
- FileSelectFile, filePathSelect, 3,,Select Quickbooks Registration File, QB Registration Files (*.dat)
- if (filePathSelect)
- GuiControl,,filePath, %filePathSelect%
- return
- ;Enables/disables other controls based on which radio button is selected
- GuiChangeChoice:
- Gui, Submit, NoHide
- if (guichoice == 1) {
- GuiControl, Disable, filePath
- GuiControl, Disable, browseButton
- GuiControl, Enable, drive_letter
- }
- else {
- GuiControl, Enable, filePath
- GuiControl, Enable, browseButton
- GuiControl, Disable, drive_letter
- }
- return
- Retrieve:
- Gui, Submit, NoHide
- if (guichoice == 1) {
- path := drive_letter . ":\ProgramData\COMMON FILES\INTUIT\QUICKBOOKS\qbregistration.dat"
- }
- else
- path := filePath
- FileRead, qbreg, %path%
- RegExMatch(qbreg, regexp_version, out_version)
- RegExmatch(qbreg, regexp_flavor, out_flavor)
- RegExMatch(qbreg, regexp_installID, out_installID)
- RegExMatch(qbreg, regexp_license, out_license)
- the_flavor := %out_flavor1%
- the_year := qbyear(out_version1)
- the_full_version = %the_flavor%%the_year%
- if (!out_version or !out_flavor or !out_installID or !out_license)
- msgbox, 48, Error pulling license information, Could not find license information at %path%
- else
- msgbox,, QB License Info, Version: %the_full_version%`nLicense: %out_license1%`nInstallation ID: %out_installID1%
- return
- GuiClose:
- GuiEscape:
- ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement