Page 1 of 1 1
Topic Options
#194467 - 2009-06-26 05:15 PM SetFocus problem
kelp7 Offline
Starting to like KiXtart

Registered: 2002-08-12
Posts: 124
Loc: UK
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

Top
#194468 - 2009-06-26 05:19 PM Re: SetFocus problem [Re: kelp7]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
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%

Top
#194470 - 2009-06-26 05:30 PM Re: SetFocus problem [Re: Allen]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
What Allen said.

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

Top
#194471 - 2009-06-26 05:32 PM Re: SetFocus problem [Re: Richard H.]
kelp7 Offline
Starting to like KiXtart

Registered: 2002-08-12
Posts: 124
Loc: UK
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

Top
#194472 - 2009-06-26 05:41 PM Re: SetFocus problem [Re: kelp7]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
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.

Top
#194474 - 2009-06-26 07:01 PM Re: SetFocus problem [Re: Allen]
kelp7 Offline
Starting to like KiXtart

Registered: 2002-08-12
Posts: 124
Loc: UK
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.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.052 seconds in which 0.022 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org