Jump to content

QuickBooks DB Server Manager


DaveTheFirst
 Share

Recommended Posts

Hey folks, first timer here, so I apologize if I'm approaching this incorrectly. Since I'd be running this script on Windows Server, this seemed the most appropriate place.

I've got a client that uses QuickBooks, and QB has this handy tool for cleaning up database connection problems whenever settings get messed up by crazy things like rebooting.

Someone on a QB support thread posted a simple AutoIT script for launching this database server manager program & running the scan. It's great. Easy to read. Run the script, it runs the scan. Here's the script: https://pastebin.com/Mz9rkCun

The trouble is, it needs a user to be logged in to run. I found things like ControlSend() instead of using Send(), and I couldn't make the script work, trying things like ControlClick(), but I couldn't get it to hone in on the button. I found a simplespy script off this forum to capture the control ID of the button, but that wasn't running, and I'm quickly feeling out of my league.

I do recognize that the best solutions are "QuickBooks shouldn't break on a server reboot" and "why are we regularly rebooting this server." Solution A is a pipe dream, and I'm working on Solution B, but in case that's out of my control, I thought I'd reach out to this community.

I'm not looking for anyone to rewrite the script for me, I'm just hoping for some guidance on how to either use ControlSend() or ControlClick() to activate that button. The current script calls Send() for Tab & Enter. Also, if I'm being a moron & it's not even possible to run it before a user logs in, I can take it. You can tell me I'm being a moron :)

Thanks for your time!

Link to comment
Share on other sites

13 minutes ago, DaveTheFirst said:

Hey folks, first timer here, so I apologize if I'm approaching this incorrectly. Since I'd be running this script on Windows Server, this seemed the most appropriate place.

I've got a client that uses QuickBooks, and QB has this handy tool for cleaning up database connection problems whenever settings get messed up by crazy things like rebooting.

Someone on a QB support thread posted a simple AutoIT script for launching this database server manager program & running the scan. It's great. Easy to read. Run the script, it runs the scan. Here's the script: https://pastebin.com/Mz9rkCun

The trouble is, it needs a user to be logged in to run. I found things like ControlSend() instead of using Send(), and I couldn't make the script work, trying things like ControlClick(), but I couldn't get it to hone in on the button. I found a simplespy script off this forum to capture the control ID of the button, but that wasn't running, and I'm quickly feeling out of my league.

I do recognize that the best solutions are "QuickBooks shouldn't break on a server reboot" and "why are we regularly rebooting this server." Solution A is a pipe dream, and I'm working on Solution B, but in case that's out of my control, I thought I'd reach out to this community.

I'm not looking for anyone to rewrite the script for me, I'm just hoping for some guidance on how to either use ControlSend() or ControlClick() to activate that button. The current script calls Send() for Tab & Enter. Also, if I'm being a moron & it's not even possible to run it before a user logs in, I can take it. You can tell me I'm being a moron :)

Thanks for your time!

can you be more specific?, also I dont use IE.

Link to comment
Share on other sites

To be able to help you with ControlClick() we need information for the button as shown in the AutoIt Window Info tool.

simplespy by junkew is used in relation to UI Automation code. Not classic automation commands as ControlClick().

But there is one UI Automation property that is interesting in connection with classic automation. That's the $UIA_AutomationIdPropertyId that can be used this way. And this method is definitely independent of a user.

Link to comment
Share on other sites

Hey folks, I'm so sorry for the late reply! I thought I'd set it to notify on replies & I must not have.

Here's the original script provided: it launches the window, tabs to a button labeled "Scan Now" & presses Enter.

Quote

; AutoIt v3.3.14.5
; https://www.autoitscript.com
#include <MsgBoxConstants.au3>

; Path to QuickBooks Database Server Manager
Global Const $qbDSM = "C:\Program Files (x86)\Common Files\Intuit\QuickBooks\QBServerUtilityMgr.exe"
; Title of window
Global Const $title = "QuickBooks Database Server Manager";

Main()

; Main Function
Func Main()
    ; check if program already running
    If WinExists("[TITLE:"&$title&"]") Then
        ;program running close it and wait 5 seconds for it close
        WinClose("[TITLE:"&$title&"]")
        WinWaitClose("[TITLE:"&$title&"]",5)
    EndIf
    Launch()
EndFunc

; launch the QuickBooks Database Server Manager
Func Launch()

    ; Check if the Program File Exists
    Local $exist = FileExists($qbDSM)

    If $exist Then ; if it does exist
        ; launch the program
        Local $iPID = Run($qbDSM)
        ; wait upto 5 seconds for the window to appear
        WinWait("[TITLE:"&$title&"]","",5)
        ; send keys to start Scan
        Scan()
    Else ; if program not found, message box saying not found
        MsgBox($MB_SYSTEMMODAL,"Error","Program " & $qbDSM & " not found")
    EndIf

EndFunc

Func Scan()
    ; send the tab key to move to [Start Scan] button
    Send("{TAB}")
    ; send the enter key to start the scan
    Send("{ENTER}")
EndFunc

Now that I'm revisiting this after a couple full workdays, I guess my most basic question is this: can AutoIT even run scripts without a user being logged in? I feel like it would need a logged in profile to launch a program in the first place.

If I do need to run it with a user logged in & I make a dummy user for the task, would the syntax for ControlSend() be:

Quote

ControlSend($title, "", , "{TAB}{ENTER}")

Sorry for the incomplete initial post. It's been a while since I worked in any sort of scripting or coding, so it's easy for me to feel overwhelmed by it all.

Link to comment
Share on other sites

  • 1 month later...

Hi,

I'm brand new to this. I used this script to open the QuickBooks Database Server Manager and then press Start Scan. Then a Warning pop-up window appears each time, "Folders containing QuickBooks files will be shared with all users on your network. If you have sensitive information in these folders, we recommend you move them to another location before your run the scan. Are you sure you want to continue?" 

Here is the summary of the AutoIt Window Info (32bit):

>>>> Window <<<<
Title:    Warning
Class:    #32770
Position:    419, 263
Size:    497, 200
Style:    0x94C801C5
ExStyle:    0x00010101
Handle:    0x00000000001505EC

>>>> Control <<<<
Class:    Button
Instance:    1
ClassnameNN:    Button1
Name:    
Advanced (Class):    [CLASS:Button; INSTANCE:1]
ID:    1
Text:    OK
Position:    277, 124
Size:    88, 26
ControlClick Coords:    43, 12
Style:    0x50030000
ExStyle:    0x00000004
Handle:    0x000000000021054E

>>>> Mouse <<<<
Position:    747, 430
Cursor ID:    0
Color:    0x7F3300

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
OK
Cancel
Folders containing QuickBooks files will be shared with all users on your network. If you have sensitive information in these folders, we recommend you move them to another location before you run the scan. Are you sure you want to continue?


>>>> Hidden Text <<<<
 

What code would I add to the script above and where would I place that code in order to press the OK button in the Warning dialog box? 

Thanks in advance. 

Steven

 

Link to comment
Share on other sites

It's what Dave posted above. It works great up until that dialog box  pops up.  Here it is:

; AutoIt v3.3.14.5
; https://www.autoitscript.com
#include <MsgBoxConstants.au3>

; Path to QuickBooks Database Server Manager
Global Const $qbDSM = "C:\Program Files (x86)\Common Files\Intuit\QuickBooks\QBServerUtilityMgr.exe"
; Title of window
Global Const $title = "QuickBooks Database Server Manager";

Main()

; Main Function
Func Main()
    ; check if program already running
    If WinExists("[TITLE:"&$title&"]") Then
        ;program running close it and wait 5 seconds for it close
        WinClose("[TITLE:"&$title&"]")
        WinWaitClose("[TITLE:"&$title&"]",5)
    EndIf
    Launch()
EndFunc

; launch the QuickBooks Database Server Manager
Func Launch()

    ; Check if the Program File Exists
    Local $exist = FileExists($qbDSM)

    If $exist Then ; if it does exist
        ; launch the program
        Local $iPID = Run($qbDSM)
        ; wait upto 5 seconds for the window to appear
        WinWait("[TITLE:"&$title&"]","",5)
        ; send keys to start Scan
        Scan()
    Else ; if program not found, message box saying not found
        MsgBox($MB_SYSTEMMODAL,"Error","Program " & $qbDSM & " not found")
    EndIf

EndFunc

Func Scan()
    ; send the tab key to move to [Start Scan] button
    Send("{TAB}")
    ; send the enter key to start the scan
    Send("{ENTER}")
EndFunc

;Thanks.

Link to comment
Share on other sites

  • 1 year later...

Steven, did you ever get anywhere with this?

I'm trying to run the script you shared (which you state you got from a QB Support Thread), but I'm having a heck of a time sending the Tab command... Shoot, I had a heck of a time opening and closing QB DB Server Manager. I had to switch to ProcessClose and ShellExecute instead of WinClose and Run commands.

 

I'm hoping you were able to figure this out. 


Thanks!

Link to comment
Share on other sites

  • 2 months later...

Steven, here is the script we use and when it works it works great. For the warning message that pops up after you select scan, we set for the script to sent Enter. Enter will select yes on that warning and continue the script. 

; AutoIt v3.3.14.5
; https://www.autoitscript.com
#include <MsgBoxConstants.au3>

; Path to QuickBooks Database Server Manager
Global Const $qbDSM = "C:\Program Files (x86)\Common Files\Intuit\QuickBooks\QBServerUtilityMgr.exe"
; Title of window
Global Const $title = "QuickBooks Database Server Manager";

Main()

; Main Function
Func Main()
    ; check if program already running


    If WinExists("[TITLE:"&$title&"]") Then
        ;program running close it and wait 5 seconds for it close
        WinClose("[TITLE:"&$title&"]")
        WinWaitClose("[TITLE:"&$title&"]",5)
    EndIf
    Launch()
EndFunc

; launch the QuickBooks Database Server Manager
Func Launch()

    ; Check if the Program File Exists
    Local $exist = FileExists($qbDSM)

    If $exist Then ; if it does exist
        ; launch the program
        Local $iPID = Run($qbDSM)
        ; wait upto 5 seconds for the window to appear
        WinWait("[TITLE:"&$title&"]","",5)
        ; wait 10 seconds incase it takes a while to launch
        Sleep (10000)
        ; Select the window to execute the remianing commands
        WinActivate($title)
        ; send keys to start Scan
        Scan()
    Else ; if program not found, message box saying not found
        MsgBox($MB_SYSTEMMODAL,"Error","Program " & $qbDSM & " not found")
    EndIf

EndFunc

Func Scan()
    ; send the tab key to move to [Start Scan] button
    Send("{TAB}")
    ; send the enter key to start the scan
    Send("{ENTER}")
    ; send the enter key to close the warning message
    Send("{ENTER}")
    ; wait 15 seconds for the scan to finish
    Sleep (15000)
    ; Lock the screen for security reasons
    ShellExecute("rundll32.exe", "user32.dll,LockWorkStation")
EndFunc

 

 

Edited by Jos
Link to comment
Share on other sites

Imagine if a support ticket was raised with Quickbooks in March last year when an issue was identified asking for a simple database integrity check within the program during startup and it was released by now as an update, with maybe a switch at startup?

Imagine!

Why is this still an issue needing third party AutoIT code as a workaround eighteen months later? I feel sorry for the entire industry. {cringes}

/rant mode off/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...