Jump to content
DaveTheFirst

QuickBooks DB Server Manager

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!

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
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.

Share this post


Link to post
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

×
×
  • Create New...