Sign in to follow this  
Followers 0
willwatters

1 & 0 Coes

7 posts in this topic

Will the following code work - if send and winclose do not work will it send 0 or does this only work for certain commands?

$errorcheck = send("Mrs k Good")

If ($errorcheck = 0) Then

_MyLog($Pre, "20", "Baji", "Data in the Attorney Name field could not be entered", "")

EndIf

$errorcheck = WinClose("BAJI/CACI Jury Instruction Selector for Windows [instructions Not Saved]")

If ($errorcheck = 0) Then

_MyLog($Pre, "20", "Baji", "BAJI failed to close", "")

EndIf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Quickly checks the docs

Hmm, let's see.

Send does not return a value. Check @Error instead.

Neither does WinClose. Check @Error for information.

Check the documentation for each of these functions for more information.

Edit: Fxi Spelling errors.

Edited by Nutster

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

Quickly checks the docs

Hmm, let's see.

Send does not return a value.  Check @Error instead.

Neither does WinClose.  Check @Error for information.

Check the documentation for each of these functions for more information.

Edit:  Fxi Spelling errors.

<{POST_SNAPBACK}>

I looked at @error and i don't understand - how can I apply it to check if a window closed successfully and if something was sent successfully?

I would really apprecaite your help.

Share this post


Link to post
Share on other sites

Will the following code work - if send and winclose do not work will it send 0 or does this only work for certain commands?

according to the docs....

send does not have a return value and does not set @error, so you cannot say

if send did work or not. Actually, send will always work, as you can always send a message. You just don't know if somebody received it.....

winclose will return either 0 ("cannot find window title) or 1 ("sucess"). Check the return code like this:

$err = winclose("window xyz").

However, winclose will only send a "CLOSE" message to the windows. This does not necessarily close the window, as it might for example ask the user to save some data. To kill a window use WinKill()

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

according to the docs....

send does not have a return value and does not set @error, so you cannot say

if send did work or not. Actually, send will always work, as you can always send a message. You just don't know if somebody received it.....

winclose will return either 0 ("cannot find window title) or 1 ("sucess"). Check the return code like this:

$err = winclose("window xyz").

However, winclose will only send a "CLOSE" message to the windows. This does not necessarily close the window, as it might for example ask the user to save some data. To kill a window use WinKill()

Cheers

Kurt

<{POST_SNAPBACK}>

I ran the following code:

$err = winclose("window xyz")

MsgBox(4096,"Test", $err)

and it gave an exit code of 1 even though the window xyz does not exist. should it have not returned 0 or does it only return 0 if a valid window cannot close?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

From help file on WinClose from release version

Return Value

None.

from beta help

Return Value

Success: Returns 1.

Failure: Returns 0 if window is not found.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

From help file on WinClose from release version

from beta help

<{POST_SNAPBACK}>

So you are saying that winclose will not return 0 for a failure and 1 for success?

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  
Followers 0