kelp7
(Starting to like KiXtart)
2009-06-26 05:15 PM
SetFocus problem

Hi,

I can't seem to use the SetFocus command to set the focus to the DOS window that is running my kix script. Return code is 1407 I believe, so it's clearly not working. Is it actually possible to do this?

Thanks


AllenAdministrator
(KiX Supporter)
2009-06-26 05:19 PM
Re: SetFocus problem

What does your setfocus line look like?

What is the name of console window?

You can title your window with something specific by using

start "My Console Window" %comspec%


Richard H.Administrator
(KiX Supporter)
2009-06-26 05:30 PM
Re: SetFocus problem

What Allen said.

You will get a 1407 error if SetFocus() cannot find a window matching your "Title" string.


kelp7
(Starting to like KiXtart)
2009-06-26 05:32 PM
Re: SetFocus problem

It's only a little test script at the moment just to see if the theory was possible, the script is just:

Break on

While 1

? "Repeating lines of text"
$x = SetFocus ("C:\Scripting\KIX32")
? $x

Loop

Exit


the script is stored on my c: drive in a folder called "scripting"

thanks


AllenAdministrator
(KiX Supporter)
2009-06-26 05:41 PM
Re: SetFocus problem

Please see the manual or the following page...
http://www.scriptlogic.com/Kixtart/htmlhelp/Functions/setfocus.htm

Its the title of the window you need to give it, not the executable.


kelp7
(Starting to like KiXtart)
2009-06-26 07:01 PM
Re: SetFocus problem

Without trying to be too pedantic a) i couldn't have known about the command without having read the manual and b) i quote "If there is no exact match, any application whose title string begins with 'title' is activated."

My window title appeared to be "c:\scripting\kix32.exe testkix.kix" hence why i searched for just the first half or so of the title string. Still i understand what you're saying and will give the 'start' command a go.