[jawsscripts] Re: Close window with SendMessage function?

  • From: "Kevin Mattingly" <kmattingly@xxxxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Fri, 14 Aug 2009 09:29:02 -0400

Jeff,

In the following example taken from the msn messenger.jss file, you do a 
check to see if the window you're in is the conversation window and if so, 
it returns a True value (1), if not it will return false (0). This check is 
used to determine whether or not you can read specific conversation threads 
in msn messenger. In the case of reviewing message thread 1, you'd hit the 
alt+1 key and it would read the last message written to the screen in the 
conversation history window. Before it can execute this read, the script has 
to determine if you're in a true conversation window.

Int Function IsInConversationWindow ()

var

string sRealName

let sRealName=GetWindowName(GetRealWindow(GetFocus()))

If StringContains(sRealName,wn_Conversation)

|| StringContains(sRealName,wn_MobileDevice) Then

Return TRUE ;The value 1

Else

Return FALSE ;The value 0

EndIf

EndFunction



HTH,

Kevin M.

----- Original Message ----- 
From: "Geoff Chapman" <gch@xxxxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Friday, August 14, 2009 9:10 AM
Subject: [jawsscripts] Re: Close window with SendMessage function?


> ah, ok. thanks Don.
> hmmmm, now perhaps this gives me a chance to display my even further
> embarrassing ignorance, and ask a question that's been kinda lurking 
> around
> in my non-informed mind for ages. if anyone would care to stoop so low to
> explain? <grin.>
> but, ... ok this is kind of pretty embarrassing to admit,
> but, I've never quite got my head around this concept yet, of functions,
> actually returning, values.
> especially user built ones.
> and in what specific circumstances I might find this useful?
>
> like in your example below Don, you indicate that SendMessage function,
> returns, an integer value?  Presumably maybe at a guess, perhaps something
> like 1 if it thought it was successful at delivering the message,
> and 0 if not maybe?  I don't know.
> ... whatever it is, how exactly might I usefully utilize/implement such a
> feature, as the value that a given function may return like this?
>
> Like I understand the concept of, "return," in the middle of a
> scrip/function, terminating the execution/running of the script/function 
> at
> that point,
> I've been able to successfully utilize that much before,
> But I don't reeeeally yet understand totally, what the fsdn means when it
> says, that it also,
> returns, "the value of an expression, if given, to the calling function.
>
> would anyone care to either posit a bit of exemplery code which might
> illustrate, or point me to a place I might find some written? that would 
> be
> sooooo excellent.
> Like sometimes I have seen the keyword, Return, in the middle of a script 
> or
> function, with things in parenthisies after it, like (0) or some other
> value?
> so like I mean do they do that, when they want the function, to carry with
> it, or return, if I'm using the term correctly here,  a certain value if 
> the
> function quits at that point? like in the midst of an if condition say?
> whereas if the condition wasn't met and the
> execution went further, resulting in more processing, that entire function
> might return some different value?
> am I halfway on the right track with how this works?
>
>
> thanks.
> and sorry for the kinda low-life question.
> i do really have a lot to learn eh.
>
> geoff c.
>
>
>
> ----- Original Message ----- 
> From: "Donald Marang" <donald.marang@xxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Friday, August 14, 2009 12:18 PM
> Subject: [jawsscripts] Re: Close window with SendMessage function?
>
>
>> Me either!  I followed the thread back where a similar postMessage call
> was
>> suggested.  It works perfectly!  I had previously had a function that
>> literally attempted five different ways to close the app and still failed
>> occasionally.  I will repeat the call here:
>> postMessage(ghVCAMain, 0x10, 0, 0) ; 0x10 is WM_Close
>>
>>
>> Don Marang
>>
>>
>> ----- Original Message ----- 
>> From: "Bryan Garaventa" <bgaraventa11@xxxxxxxxxxxxxx>
>> To: <jawsscripts@xxxxxxxxxxxxx>
>> Sent: Thursday, August 13, 2009 9:46 PM
>> Subject: [jawsscripts] Re: Close window with SendMessage function?
>>
>>
>> > That is sort of weird... I was able to close an app's main window by
> using
>> > SendMessage(GetAppMainWindow(GetFocus()), 0x10, 0, 0)
>> > I'm not sure what could be happening.
>> >
>> > ----- Original Message ----- 
>> > From: "Donald Marang" <donald.marang@xxxxxxxxx>
>> > To: <jawsscripts@xxxxxxxxxxxxx>
>> > Sent: Thursday, August 13, 2009 6:20 PM
>> > Subject: [jawsscripts] Re: Close window with SendMessage function?
>> >
>> >
>> >>I did see this function in that list.  However, functions that I have
>> >> written and merged with default.jss also show up in this list.  I also
>> >> have
>> >> several tools added to my JAWS installation.  I was wondering if I
> would
>> >> require other users to have certain tools installed if I distribute 
>> >> any
>> >> scripts.  So far, it is not closing any windows or applications and
>> >> always
>> >> returns 0.
>> >>
>> >> Don Marang
>> >>
>> >>
>> >> ----- Original Message ----- 
>> >> From: "Bryan Garaventa" <bgaraventa11@xxxxxxxxxxxxxx>
>> >> To: <jawsscripts@xxxxxxxxxxxxx>
>> >> Sent: Thursday, August 13, 2009 6:42 PM
>> >> Subject: [jawsscripts] Re: Close window with SendMessage function?
>> >>
>> >>
>> >>> Nope, you should see SendMessage in your JAWS functions list, as well
> as
>> >>> PostMessage, which provides limited access to the API through JAWS.
>> >>>
>> >>> ----- Original Message ----- 
>> >>> From: "Donald Marang" <donald.marang@xxxxxxxxx>
>> >>> To: <jawsscripts@xxxxxxxxxxxxx>
>> >>> Sent: Thursday, August 13, 2009 3:28 PM
>> >>> Subject: [jawsscripts] Re: Close window with SendMessage function?
>> >>>
>> >>>
>> >>>> Is the SendMessage function a built-in JAWS function or is it part 
>> >>>> of
>> >>>> another package, such as HomerKit?  Do you need to load or provide
> any
>> >>>> other
>> >>>> commands first such as an Use statement?
>> >>>>
>> >>>> Don Marang
>> >>>>
>> >>>>
>> >>>> ----- Original Message ----- 
>> >>>> From: "Jim Bauer" <holdsworthfan@xxxxxx>
>> >>>> To: <jawsscripts@xxxxxxxxxxxxx>
>> >>>> Sent: Thursday, August 13, 2009 4:46 PM
>> >>>> Subject: [jawsscripts] Re: Close window with SendMessage function?
>> >>>>
>> >>>>
>> >>>>> sendMessage(hwnd, 0x0112, 0x000F, 0)
>> >>>>> The populated parameters are wm_syscommand and wm_close,
> respectively.
>> >>>>>>-----Original Message-----
>> >>>>>>From: jawsscripts-bounce@xxxxxxxxxxxxx
>> >>>>>>[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Bryan
> Garaventa
>> >>>>>>Sent: Tuesday, August 11, 2009 2:13 PM
>> >>>>>>To: jawsscripts@xxxxxxxxxxxxx
>> >>>>>>Subject: [jawsscripts] Close window with SendMessage function?
>> >>>>>>
>> >>>>>>Does anyone know what the correct parameters are for forcing a
> window
>> >>>>>>to
>> >>>>>>close using the SendMessage function? The window handle is pretty
>> >>>>>>obvious,
>> >>>>>>but I'm not sure what the other constants should be.
>> >>>>>>Thanks,
>> >>>>>>Bryan
>> >>>>>>__________
>> >>>>>>Visit and contribute to The JAWS Script Repository
>> >>>>>>http://jawsscripts.com
>> >>>>>>
>> >>>>>>View the list's information and change your settings at
>> >>>>>>http://www.freelists.org/list/jawsscripts
>> >>>>>>
>> >>>>>>
>> >>>>>>__________
>> >>>>>>Visit and contribute to The JAWS Script Repository
>> >>>>>>http://jawsscripts.com
>> >>>>>>
>> >>>>>>View the list's information and change your settings at
>> >>>>>>http://www.freelists.org/list/jawsscripts
>> >>>>>>
>> >>>>>>
>> >>>>>>This e-mail and any attachments to it are confidential and are
>> >>>>>>intended
>> >>>>>>solely for use of the individual or entity to whom they are
> addressed.
>> >>>>>>If
>> >>>>>>you have received this e-mail in error, please notify the sender
>> >>>>>>immediately and then delete it.  If you are not the intended
>> >>>>>>recipient,
>> >>>>>>you must not keep, use, disclose, copy or distribute this e-mail
>> >>>>>>without
>> >>>>>>the author's prior permission.  The views expressed in this e-mail
>> >>>>>>message
>> >>>>>>do not necessarily represent the views of Highmark Inc., its
>> >>>>>>subsidiaries,
>> >>>>>>or affiliates.
>> >>>>>>__________
>> >>>>>>Visit and contribute to The JAWS Script Repository
>> >>>>>>http://jawsscripts.com
>> >>>>>>
>> >>>>>>View the list's information and change your settings at
>> >>>>>>http://www.freelists.org/list/jawsscripts
>> >>>>>
>> >>>>> __________
>> >>>>> Visit and contribute to The JAWS Script Repository
>> >>>>> http://jawsscripts.com
>> >>>>>
>> >>>>> View the list's information and change your settings at
>> >>>>> http://www.freelists.org/list/jawsscripts
>> >>>>>
>> >>>>
>> >>>> __________
>> >>>> Visit and contribute to The JAWS Script Repository
>> >>>> http://jawsscripts.com
>> >>>>
>> >>>> View the list's information and change your settings at
>> >>>> http://www.freelists.org/list/jawsscripts
>> >>>>
>> >>>
>> >>> __________
>> >>> Visit and contribute to The JAWS Script Repository
>> >>> http://jawsscripts.com
>> >>>
>> >>> View the list's information and change your settings at
>> >>> http://www.freelists.org/list/jawsscripts
>> >>>
>> >>>
>> >>
>> >> __________
>> >> Visit and contribute to The JAWS Script Repository
> http://jawsscripts.com
>> >>
>> >> View the list's information and change your settings at
>> >> http://www.freelists.org/list/jawsscripts
>> >>
>> >
>> > __________
>> > Visit and contribute to The JAWS Script Repository
> http://jawsscripts.com
>> >
>> > View the list's information and change your settings at
>> > http://www.freelists.org/list/jawsscripts
>> >
>>
>> __________
>> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>>
>> View the list's information and change your settings at
>> http://www.freelists.org/list/jawsscripts
>>
>
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> 

__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: