Jump to content
Sign in to follow this  
jeremym

Losing my mind with my simple script

Recommended Posts

jeremym

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
jeremym

"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

:)

Share this post


Link to post
Share on other sites
PsaltyDS

"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

Share this post


Link to post
Share on other sites
jeremym

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

:)

Share this post


Link to post
Share on other sites
titewad

Try adding this after the Winwaitactive:

ControlFocus('Name Not Found')

Share this post


Link to post
Share on other sites
therks

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.

Share this post


Link to post
Share on other sites
jeremym

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.

Share this post


Link to post
Share on other sites
1905russell

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

Share this post


Link to post
Share on other sites
Zedna

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

Share this post


Link to post
Share on other sites
1905russell

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.

Share this post


Link to post
Share on other sites
enaiman

@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 :)

Share this post


Link to post
Share on other sites
1905russell

@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

Share this post


Link to post
Share on other sites
Zedna

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

Share this post


Link to post
Share on other sites
1905russell

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

Sorry I thought it was at me.

You are absolutely right with Quickbooks

Opt("WinTitleMatchMode", 2)

is your friend.

Share this post


Link to post
Share on other sites
enaiman

@Zedna

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

:)

@1905russell

Opt("WinTitleMatchMode", 2)

is your friend.

This use to solve many WinWaitActive hangups :)

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 :)

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.