Page 1 of 1 1
Topic Options
#77511 - 2001-04-05 07:34 PM Error on Setfocus() function
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
SetFocus generates an error if the Window to get the focus dosn't exist.

This script works if WordPad is opened, but crashes if WordPad is not opened.

code:
Break On
SetConsole("AlwaysOnTop")
$WinTittle = "Document - WordPad"
If SetFocus("$WinTittle") = 0
$Err = SendKeys("~{F4}")
EndIf

Return


I have tested this for Win95 and WinNT


Erik

Top
#77512 - 2001-04-05 07:55 PM Re: Error on Setfocus() function
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Your script doesn't give wordpad enough time to open.

Try this one:

CopyPasteNotepad.kix

code:

break on cls del "c:\filename.txt"


; write your name to a blank screen
@userid ?


; copy this to the clipboard
$=sendkeys("~ es{enter}")


; run notepad
run "notepad"


; loop until notepad has focus
while setfocus("Untitled - Notepad")<>0 loop


; uncomment ONE of the following only:


; paste clipboard to notepad
$=sendkeys("^v")


; paste clipboard, save as 'c:\filename.txt' and exit notepad
;$=sendkeys("^v^sc:\filename.txt{enter}~{f4}")


The While...Loop causes the script to pause until notepad is running.


cj

[This message has been edited by cj (edited 05 April 2001).]

Top
#77513 - 2001-04-05 08:38 PM Re: Error on Setfocus() function
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
CJ

Have you tested your script with Kix2001 ?

I have tested your script with both Ki32.exe and Kix32c.exe, Both versions crash when they meet SetFocus()

I use SetFocus() to test for the existance af a window in my main script (about 1200 lines), the SetFocus() function was the only one giving trouble.

By the way the only difference for Kix32 and Kix32c i have observed is that Kix32 is the consoleless version starting a new instance of "DOS", where Kix32c stays in the current window.

Erik

Top
#77514 - 2001-04-05 10:03 PM Re: Error on Setfocus() function
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
I am using Win2k pro...

I tested with both Kix32 and Kix32c and both work.

I do not have notepad running when the script runs as the script launches notepad already. If notepad IS running, the script opens a new one and uses it instead.

Are you getting an error.

Kix32.exe and Kix32c.exe are the same except that Kix32c.exe uses the current command prompt window.

I dressed my original script for the previous post, here is the original.

copypastenotepad.kix

code:

break on
cls


@wksta ", 123.45.67" ?

$=sendkeys("~ es{enter}")


run "notepad"

while setfocus("Untitled - Notepad")<>0 loop


$=sendkeys("^v^sc:\scripts\filename.txt{enter}~{f4}")


cj


Top
#77515 - 2001-04-06 07:29 PM Re: Error on Setfocus() function
Anonymous
Unregistered


Thanks for the report. Setfocus indeed has a regression in it causing KiXtart to fail if the window you are trying to change focus to doesn't exist. This will be fixed in the next public build.

Thanks again,

Ruud

Top
#77516 - 2001-05-22 05:30 PM Re: Error on Setfocus() function
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
I don't know what beta version of kix you were using CJ, but this is still a problem with Beta 2 build 11.

Judging by the dates of the posts you were using beta 1.

A setfocus() causes a program error(dr watson) on my win2k workstation.

Bryce

------------------
kix.isorg.net

Top
#77517 - 2001-05-22 09:54 PM Re: Error on Setfocus() function
Anonymous
Unregistered


Are you sure this is build 11? I can't reproduce the problem with build 11 or up?

Regards,

Ruud

Top
#77518 - 2001-05-23 04:45 PM Re: Error on Setfocus() function
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
you are correct Ruud.... this problem was fixed.

foolish me had only the beta 2 build 11 version of kix32c.exe. Kix32.exe was first public beta release.

sorry
Bryce

------------------
kix.isorg.net

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.139 seconds in which 0.08 seconds were spent on a total of 11 queries. Zlib compression enabled.