Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WSH and Taking control back from active application
Message
De
05/10/2000 05:06:18
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
WSH and Taking control back from active application
Divers
Thread ID:
00425183
Message ID:
00425183
Vues:
267
I was reading Mr. Tasker`s and Mr Rauh vfug article conserning the wsh and I thought they could help
I use the wsh in a real application. I was using the popup method with the timeout option when after reading Mr. Taskers and Mr Rauh vfug article i realize that it doesnot work "by design". The problem seems to be general because the popup looses its timeout capabilities even if i run the script as a vbs but having at the same time a referance to visual foxpro com object :

set oFox = CreateObject("Fox.FoxSomeClass")
Wscript.Sleep (200)

WshShell.AppActivate ("someapplication")
Wscript.Sleep(100)

FOR ii = 1 TO 10000
' print all text pages
WshShell.SendKeys("%P")
Wscript.Sleep( 150)
WshShell.SendKeys ("{DOWN}")
Wscript.Sleep (150)
WshShell.SendKeys (" ")
Wscript.Sleep (150)
WshShell.SendKeys( "{TAB}")
Wscript.Sleep (150)
WshShell.SendKeys (" ")
Wscript.Sleep (3000)

' call the fox com object method

oFox.SomeMethod

intButton = WshShell.Popup("efvfvf, 4, "DSFFSDFSD", 1) ' Even if there is a timeout parameter this does not work


IF intButton = 2 then
EXIT for
END IF
WshShell.AppActivate( "SEAT")
Wscript.Sleep (100)
WshShell.SendKeys ("%F")
Wscript.Sleep (3000)
NEXT
was reading your article for wsh in vfug and i triedexperimenting with the examples.I wrote the following code:


Why do i need the popup with timeout? Because as you see i need a way to interact with the user (in order to exit the script ...), but because this is mostly an
automated application if the user does not do anything then the script must continue.
I tried to solve the problem by using the wsh from inside fox by doing the same things exept taking again the control back to fox when i want to interact with the user
The idea was:

public nhandle
_SCREEN.Caption = "title"
nHandle = Is_Run32("ETKA MERGE") &&i use Mr Tasker´s utility Thank You ...
?nhandle

SET SAFE OFF

DECLARE Sleep IN Win32API;
INTEGER dwMilliseconds

DECLARE INTEGER SetForegroundWindow IN win32api LONG lnhWnd
DECLARE INTEGER GetWindowText IN win32api INTEGER, STRING, INTEGER
DECLARE INTEGER GetWindow IN win32api INTEGER,INTEGER
DECLARE INTEGER IsWindowVisible IN win32api INTEGER
DECLARE INTEGER GetActiveWindow IN win32api
DECLARE INTEGER BringWindowToTop IN WIN32API LONG



= Sleep(100) && Pause VFP for a 1/10 of a second

WshShell = CreateObject("WScript.Shell")
=Sleep (200)
WshShell.AppActivate ("somewindow")
=Sleep(300)
SetForegroundWindow(nHandle)
if inkey(2) = ...
....
Unfortunatelly this does not work either. The Vfp window does not come in front ... and the must manually alt+tab to vfp ...

It seems to me -please show me that i am wrong - that sometimes fox gives us 2 things - oens the appetite but then take the half back

Thank You

Dimitrios Papadopoulos
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform