Page 1 of 1 1
Topic Options
#21676 - 2002-05-13 09:12 PM automation of notes
bluesteel Offline
Fresh Scripter

Registered: 2002-05-13
Posts: 32
Loc: Montreal, Quebec Canada
hi all, im new to kixtart, and ive been doing some basic scripting.....i made a script that would automate the setup of lotus notes(after installation, the preferences and server setup)..... the script works most of the time, however when something happens out of the scripts parameters it screws up........my script involves using sendkeys to send the cursor through the motions of the setup, but when a window pops up, like new mail or somethng similar, the script cannot handle it. how can i make it so my script is more flexible?
Top
#21677 - 2002-05-14 09:38 AM Re: automation of notes
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Well ,

If you know exactly what the name of the Window is you want to send a key to you could do a

setfocus("Windowname")

before sending keys ...

hth

Jochen
_________________________



Top
#21678 - 2002-05-14 06:23 PM Re: automation of notes
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I think it goes beyond doing a setfocus. For example, in Outlook if a meeting reminder pops up, you can't do anything with the main menu on Outlook until the meeting reminder is "dealt" with.

AutoIt uses something called the "Adlib" section. Basically, its a one line routine that checks a condition (i.e. IfWinExist) then executes something (i.e. Sendkeys) based of of that condition. The "Adlib" section condition is checked after each line of code is run then automatically returns to where it left off.

To duplicate something like an "Adlib" section, you would have to run a second script (not Shell or Call) and have the script loop until the Window to be dealt with exists (i.e. wait until Meeting Reminder pops up, then SEND an {esc}).

[ 14 May 2002, 18:24: Message edited by: Chris S. ]

Top
#21679 - 2002-05-14 06:34 PM Re: automation of notes
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Sounds like AutoIT may be the better solution. No experience with it but worthy of further investigation.

I have tried working with SetFocus() but depending on the modality of the window, often could not detect the specific window in order to deal with it.

Correct me if I'm wrong, but if the window is application modal, SetFocus() cannot detect it but can detect only the parent application's window. At least that's been my experience FWIW.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#21680 - 2002-05-14 07:09 PM Re: automation of notes
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
We can use AutoIt within a KiX script as well. In fact, the two complement each other nicely. KiX can do many things that AutoIt cannot. AutoIt handles "windows" better. Here's a sample of using the AutoItX.dll:

code:
; Check for and install AutoItX.dll if not present.
if exist("%windir%\autoitx.dll")=0
copy "@scriptdir\autoitx.dll" "%windir%"
shell "regsvr32 /s %windir%\autoitx.dll"
endif
$oAutoIt = CreateObject("AutoItX.Control")
if $oAutoIt=0
? "AutoItX not registered."
endif
; Pause script until "Version Conflict" window exists.
; Then send an ALT-Y to confirm "Keep existing driver."
$=$oAutoIt.WinWaitActive ("Version Conflict","",0)
$=sendkeys("~Y")

As mentioned, this script would have to be running concurrently with the execution of another script. This "Adlib" example would just be sitting there waiting until the proper condition existed. Probably not the best example in the world, as it would stay paused until that window popped up. It would be better to do a "IfWinExist." You could then have the "Adlib" loop as long as Outlook (or Notes in this case) is open. Then, once Outlook is closed, the "Adlib" script exits.

Top
#21681 - 2002-05-14 08:51 PM Re: automation of notes
bluesteel Offline
Fresh Scripter

Registered: 2002-05-13
Posts: 32
Loc: Montreal, Quebec Canada
Thats a great idea, thx. I was thinking along the lines of a setfocus(), but i figured it wouldnt work because it may not always be the same window that activates.........but i'll give that a try.

thx

Top
#21682 - 2002-05-14 10:04 PM Re: automation of notes
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
If you have different possible windows that could pop up you could have your "Adlib" loop constantly checking the "title" of the active window with this AutoItX command:

code:
$variable=$oAutoIt.WinGetActiveTitle()


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 931 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.061 seconds in which 0.03 seconds were spent on a total of 12 queries. Zlib compression enabled.

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