Jump to content

Losing my mind with my simple script


Recommended Posts

Hi team. Great job on all the new V3 features. I've been a V2 fan for a loong time.

But I'm running into some snags.. with a really simple script.

I've got the V2 and V3 (converted) versions below.

Here's my main issue:

-The script keeps pausing and unpausing it doesn't seem to do anything

-I can't "see" where I am in the script anymore.. like in V2 with the little popup window showing me which line is being executed right now to see what the hangup is.

-And, in other news.. what happened to /reveal mode?

Thanks.

V3 (converted):

while (1) ; start : beginning of loop OR Func start ()

AutoItSetOption ( "WinDetectHiddenText", 1 )

WinWaitActive ( 'Name Not Found' )

Send ( '{TAB}{Enter}' )

WinWaitActive ( 'Select Name Type' )

Send ( '{DOWN}{DOWN}{DOWN}{SPACE}{ENTER}' )

MouseMove ( 308, 542 )

MouseClick( "left", 308, 542 )

wend ; start

V2 (working):

start:

DetectHiddenText,on

WinWaitActive,Name Not Found

Send,{TAB}{Enter}

WinWaitActive,Select Name Type

Send,{DOWN}{DOWN}{DOWN}{SPACE}{ENTER}

;WinWaitActive,Moskowitz, inc. - QuickBooks Pro 2005

MouseMove,308,542

LeftClick,308,542

goto,start

Link to comment
Share on other sites

It is not good practice to set options in a loop, generally. And you seem to have skipped the window title parameter when watching for particular window text:

AutoItSetOption("WinDetectHiddenText", 1)
$WinTitle = "Your Window"
While (1) ; start : beginning of loop OR Func start ()
    WinWaitActive($WinTitle, 'Name Not Found')
    Send('{TAB}{Enter}')
    WinWaitActive($WinTitle, 'Select Name Type')
    Send('{DOWN}{DOWN}{DOWN}{SPACE}{ENTER}')
    MouseMove(308, 542)
    MouseClick("left", 308, 542)
WEnd ; start

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

"Name Not Found" is the name of the window.

I'm reading the help and it says that

WinWaitActive("Name Not Found")

ought to work.

But it doesn't.

And, what about the other question.. How can I see what line in the script we're currently executing?

Thx.

PS: So, at this point, I'm still "dead in the water" as the updated script doesn't yet work. :-(

--

It is not good practice to set options in a loop, generally. And you seem to have skipped the window title parameter when watching for particular window text:

AutoItSetOption("WinDetectHiddenText", 1)
$WinTitle = "Your Window"
While (1) ; start : beginning of loop OR Func start ()
    WinWaitActive($WinTitle, 'Name Not Found')
    Send('{TAB}{Enter}')
    WinWaitActive($WinTitle, 'Select Name Type')
    Send('{DOWN}{DOWN}{DOWN}{SPACE}{ENTER}')
    MouseMove(308, 542)
    MouseClick("left", 308, 542)
WEnd ; start

:)

Link to comment
Share on other sites

"Name Not Found" is the name of the window.

Oops. My bad. I thought you were searching for that as window text without a title.

And, what about the other question.. How can I see what line in the script we're currently executing?

Check out the option "TrayIconDebug" in the help file.

PS: So, at this point, I'm still "dead in the water" as the updated script doesn't yet work. :-(

Does that mean it didn't work like this?:

Opt("WinDetectHiddenText", 1)
Opt("TrayIconDebug", 1) ; Displays current line when you mouse over the icon

While (1) ; start : beginning of loop OR Func start ()
    WinWaitActive('Name Not Found')
    Send('{TAB}{Enter}')
    WinWaitActive('Select Name Type')
    Send('{DOWN}{DOWN}{DOWN}{SPACE}{ENTER}')
    MouseClick("left", 308, 542)
WEnd ; start

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Got the newest update from you. Thanks.

But, still.. it's still not working.

The tray icon shows that the script

is pausing at all the WinWaitActive commands,

and not doing any others -- at all...

except looping back to the top.

If I manually progress past the "Name Not Found" dialog box

by clicking it, I see the script jump to, say, line 7

where it's waiting for the next window.

In no cases are Mouse or Keyboard commands ever sent.

PS: my system is Vista. I'm Running as Admin.

Oops. My bad. I thought you were searching for that as window text without a title.

Check out the option "TrayIconDebug" in the help file.

Does that mean it didn't work like this?:

Opt("WinDetectHiddenText", 1)
Opt("TrayIconDebug", 1) ; Displays current line when you mouse over the icon

While (1) ; start : beginning of loop OR Func start ()
    WinWaitActive('Name Not Found')
    Send('{TAB}{Enter}')
    WinWaitActive('Select Name Type')
    Send('{DOWN}{DOWN}{DOWN}{SPACE}{ENTER}')
    MouseClick("left", 308, 542)
WEnd ; start

:)

Link to comment
Share on other sites

It's Quickbooks 2006. Seems standard-ish. Has wierd shaing... but otherwise, seems standard.

My AutoIT v2 script worked lilke a champ. But it doesn't work here either .. now

that my host is a vista machine.

Is this a normal window? Like with the system buttons (maxi, mini, close), titlebar, etc? I've had some odd experiences with WinWaitActive with windows that aren't standard windows.

Link to comment
Share on other sites

  • 3 weeks later...

It's Quickbooks 2006. Seems standard-ish. Has wierd shaing... but otherwise, seems standard.

My AutoIT v2 script worked lilke a champ. But it doesn't work here either .. now

that my host is a vista machine.

Just saw this three week old thread. I dont know if you have resolved this yet but I have encountered many problems scripting with Quickbooks and have managed to sort most of them out. If this is a Vista problem then I cant help. What exactly are you trying to do? There might be an alternative approach? Where would Name Not Found window appear in QB, as everything is picked from a list box or linked to a report, register, account etc? What version of QB 2006 are you using pro, premier, manufacturing etc.?
Link to comment
Share on other sites

Try this:

Opt("WinDetectHiddenText", 1)
Opt("TrayIconDebug", 1) ; Displays current line when you mouse over the icon

While 1 
    If WinExists('Name Not Found') Then
        WinActivate('Name Not Found')
        WinWaitActive('Name Not Found')
        Send('{TAB}{Enter}')
        WinWaitActive('Select Name Type')
        Send('{DOWN}{DOWN}{DOWN}{SPACE}{ENTER}')
        MouseClick("left", 308, 542)
    EndIf
    Sleep(100)
WEnd
Link to comment
Share on other sites

Try this:

Opt("WinDetectHiddenText", 1)
Opt("TrayIconDebug", 1) ; Displays current line when you mouse over the icon

While 1 
    If WinExists('Name Not Found') Then
        WinActivate('Name Not Found')
        WinWaitActive('Name Not Found')
        Send('{TAB}{Enter}')
        WinWaitActive('Select Name Type')
        Send('{DOWN}{DOWN}{DOWN}{SPACE}{ENTER}')
        MouseClick("left", 308, 542)
    EndIf
    Sleep(100)
WEnd
Would love to try it if I knew where to operate this from?

I can't find any window 'Name Not Found' or 'Select Name Type' in QB.

I like - Sleep(xxx) - you need lots of these when working with QB.

Link to comment
Share on other sites

@jeremym

Try to add:

Opt("WinTitleMatchMode", 2)

and shorten the desired name: "Name Not Found" to something shorter but characteristic like "Not Found" or "Found" or something else.

This worked for me when everything else failed.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

@jeremym

Try to add:

Opt("WinTitleMatchMode", 2)

and shorten the desired name: "Name Not Found" to something shorter but characteristic like "Not Found" or "Found" or something else.

This worked for me when everything else failed.

I am not having a problem with any window matching or any script. I'm having a problem finding anywhere in QuickBooks a screen with the words "Name Not Found" or "Not Found" or "Found" or "ound" or "und". I know how to detect a window with AI, thanks anyway. At this point this was a QB question not an AI question. I wanted and should have been able to test that script supposedly written for QB 2006 but I didn't know where in QB to run it - so I was asking. QB is designed for every name to either exist (in a listbox) or to be created on the fly (from the listbox). That "Name Not Found" message runs against the way it works and I suspect its referring to another AI Gui or more likely an external program or the real name has been changed (for whatever reason). Edited by 1905russell
Link to comment
Share on other sites

I am not having a problem with any window matching or any script. I'm having a problem finding anywhere in QuickBooks a screen with the words "Name Not Found" or "Not Found" or "Found" or "ound" or "und". I know how to detect a window with AI, thanks anyway. At this point this was a QB question not an AI question. I wanted to test that script supposedly written for QB 2006 but I suspect its referring to an AI Gui and not any QB module.

I was answerring to jeremym's code. Look at first post...

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...