Jump to content
DuByD

Client Window and activating changes?

Recommended Posts

Had several old scripts that ran under I believe 3.35. I have just setup/reloaded and older computer and downloaded the latest version and my scripts are no longer activating and setting the area for the windows it seems... I have written a simple script to take two notepad windows and move the mouse around the inner window area starting at 10% -90%, X and Y, to move the mouse around a TBox that I have setup... Can anyone help me as to figure out what has changed?

 

program MultipleClientTest;
 var  
   Wnds: THwndArray;
   ClientVM1,ClientVM2 : TSCARWindowClient;
   VM1Width, VM1Height : Integer;
   VM2Width, VM2Height : Integer;
   VM1TB,VM2TB : TBox;
   TBoxX1,TBoxX2,TBoxY1,TBoxY2 : Single;  
const
   VM1Title = 'test1 .*/i'; 
   VM2Title = 'test2 .*/i';
   Debug = True;
   DebugMsgWait = 500;          
procedure DebugInfo(msg : String);
begin
 WriteLn(msg);
 Wait(DebugMsgWait);
end;
procedure SetupClientVM1;
begin
 If Debug Then DebugInfo('Setting Up Client VM1.');  
 Wnds := FindWindowsPreg(GetDesktopWindow,VM1Title,'', False);
 WriteLn(Wnds[0]);      
 ClientVM1 := TSCARWindowClient.Create(Wnds[0]);
 SetClient(ClientVM1); 
 ClientVM1.Activate;    
 ClientVM1.ClientArea := True;
 VM1Width := ClientVM1.ImageArea.X2 + 1;
 VM1Height := ClientVM1.ImageArea.Y2 + 1;    
end;
procedure SetupClientVM2;
begin
 If Debug Then DebugInfo('Setting Up Client VM2.');  
 Wnds := FindWindowsPreg(GetDesktopWindow,VM2Title,'', False);      
 ClientVM2 := TSCARWindowClient.Create(Wnds[0]);
 SetClient(ClientVM2); 
 ClientVM2.Activate;    
 ClientVM2.ClientArea := True;
 VM2Width := ClientVM2.ImageArea.X2 + 1;
 VM2Height := ClientVM2.ImageArea.Y2 + 1;    
end;
procedure SetupRatios;
begin
 If Debug Then DebugInfo('Setting Up Ratios.');
   //Screen Percentages    
   TBoxX1 := 0.1;
   TBoxX2 := 0.9;
   TBoxY1 := 0.1;
   TBoxY2 := 0.9;
end;
function CreateTBox(X,Y : Integer; RX1,RY1,RX2,RY2 : Single) : TBox;
var tb : TBox;
   X1,X2,Y1,Y2 : Integer;
begin
 If Debug Then DebugInfo('Setting Up Box.');
   X1 := Floor(X * RX1);
   X2 := Floor(X * RX2);
   Y1 := Floor(Y * RY1);
   Y2 := Floor(Y * RY2);
   tb := Box(X1,Y1,X2,Y2);
   Result := tb;
end;
procedure SetupBoxesVM1;
begin
 If Debug Then DebugInfo('Setting Up Boxes VM1.'); 
 VM1TB := CreateTBox(VM1Width,VM1Height,TBoxX1,TBoxY1,TBoxX2,TBoxY2);
end;
procedure SetupBoxesVM2;
begin
 If Debug Then DebugInfo('Setting Up Boxes VM2.'); 
 VM2TB := CreateTBox(VM2Width,VM2Height,TBoxX1,TBoxY1,TBoxX2,TBoxY2);
end;
procedure MoveMouseAroundTBox(Client : TSCARWindowClient; tb : TBox);
begin
   SetClient(Client);
   Client.Activate;
   Client.ClientArea := True; 
   MoveMouse(tb.X1,tb.Y1);
   wait(1000)
   MoveMouse(tb.X2,tb.Y1);
   wait(1000)
   MoveMouse(tb.X2,tb.Y2);
   wait(1000)
   MoveMouse(tb.X1,tb.Y2);
   wait(1000)
   MoveMouse(tb.X1,tb.Y1);
   wait(1000)
end;

begin
 SetupClientVM1;
 SetupClientVM2;
 SetupRatios;
 SetupBoxesVM1;
 SetupBoxesVM2;
 MoveMouseAroundTBox(ClientVM1,VM1TB);
 MoveMouseAroundTBox(ClientVM2,VM2TB);
end.

 

- - - Updated - - -

 

Should have added that I created two notepad documents and saved them as test1 and test2. The tBox is created using ratios because the screens that I am dealing with can be changed in size or scaled. I am using virtual box VMs. This way I can define search areas via the tboxs that are set to each VMs scaling... So this should grab the size of the area of the notepad documents and move the mouse around then the same regardless of the size of the windows.

MultipleClientTest.txt

Link to comment
Share on other sites

I found my own problem... LOL... VM1Title = 'test1 .*/i'; needed to be VM1Title = '/test1 .*/i';

Now with this new program, I am not finding the correct client... Is there any way to get the title of the window from the handle?

 

- - - Updated - - -

 

Finding my actual VMs now... Running MEmu instead of VBox and was a little tougher to pick the title correctly than before...

Changed

Wnds := FindWindowsPreg(GetDesktopWindow,VM1Title,'', False);
to
Wnds := FindWindows(VM1Title);
for both and it is finding them now... with the other way without the "/" it was finding something just not the correct window.

 

Now a very odd thing is happening that I cannot wrap my head around... When I run the test script, the mouse doesn't move... But after clicking run, when it gets to the mouse movement part, if I click on a blank spot on my desktop, the mouse will move to the correct location... I have to click a blank area between each call to MoveMouseAroundTBox. Is this because I have to have the parent window, the desktop selected before setting and activating the clients again? Sorry it has been a couple of years since I did this... lol Used a debug message to time when to click on the desktop...

 

program MultipleClientTest;
 var  
   Wnds: THwndArray;
   ClientVM1,ClientVM2 : TSCARWindowClient;
   VM1Width, VM1Height : Integer;
   VM2Width, VM2Height : Integer;
   VM1TB,VM2TB : TBox;
   TBoxX1,TBoxX2,TBoxY1,TBoxY2 : Single;  
const
   VM1Title = 'MEmu 2.1.1 - MEmu_1'; 
   VM2Title = 'MEmu 2.1.1 - MEmu_2';
   Debug = True;
   DebugMsgWait = 500;          
procedure DebugInfo(msg : String);
begin
 WriteLn(msg);
 Wait(DebugMsgWait);
end;
procedure SetupClientVM1;
begin
 If Debug Then DebugInfo('Setting Up Client VM1.');  
 //Wnds := FindWindowsPreg(GetDesktopWindow,VM1Title,'', False);
 Wnds := FindWindows(VM1Title);
 WriteLn(Wnds[0]);      
 ClientVM1 := TSCARWindowClient.Create(Wnds[0]);
 SetClient(ClientVM1); 
 ClientVM1.Activate;    
 ClientVM1.ClientArea := True;
 VM1Width := ClientVM1.ImageArea.X2 + 1;
 VM1Height := ClientVM1.ImageArea.Y2 + 1;    
end;
procedure SetupClientVM2;
begin
 If Debug Then DebugInfo('Setting Up Client VM2.');  
 //Wnds := FindWindowsPreg(GetDesktopWindow,VM2Title,'', False);      
 Wnds := FindWindows(VM2Title);      
 WriteLn(Wnds[0]);      
 ClientVM2 := TSCARWindowClient.Create(Wnds[0]);
 SetClient(ClientVM2); 
 ClientVM2.Activate;    
 ClientVM2.ClientArea := True;
 VM2Width := ClientVM2.ImageArea.X2 + 1;
 VM2Height := ClientVM2.ImageArea.Y2 + 1;    
end;
procedure SetupRatios;
begin
 If Debug Then DebugInfo('Setting Up Ratios.');
   //Screen Percentages    
   TBoxX1 := 0.1;
   TBoxX2 := 0.9;
   TBoxY1 := 0.1;
   TBoxY2 := 0.9;
end;
function CreateTBox(X,Y : Integer; RX1,RY1,RX2,RY2 : Single) : TBox;
var tb : TBox;
   X1,X2,Y1,Y2 : Integer;
begin
 If Debug Then DebugInfo('Setting Up Box.');
   X1 := Floor(X * RX1);
   X2 := Floor(X * RX2);
   Y1 := Floor(Y * RY1);
   Y2 := Floor(Y * RY2);
   tb := Box(X1,Y1,X2,Y2);
   WriteLn(BoxToStr(tb));
   Result := tb;
end;
procedure SetupBoxesVM1;
begin
 If Debug Then DebugInfo('Setting Up Boxes VM1.'); 
 VM1TB := CreateTBox(VM1Width,VM1Height,TBoxX1,TBoxY1,TBoxX2,TBoxY2);
end;
procedure SetupBoxesVM2;
begin
 If Debug Then DebugInfo('Setting Up Boxes VM2.'); 
 VM2TB := CreateTBox(VM2Width,VM2Height,TBoxX1,TBoxY1,TBoxX2,TBoxY2);
end;
procedure MoveMouseAroundTBox(Client : TSCARWindowClient; tb : TBox);
begin
   If Debug Then DebugInfo('Moving Mouse!'); 
   SetClient(Client);
   Client.Activate;
   Client.ClientArea := True; 
   MoveMouse(tb.X1,tb.Y1);
   wait(1000)
   MoveMouse(tb.X2,tb.Y1);
   wait(1000)
   MoveMouse(tb.X2,tb.Y2);
   wait(1000)
   MoveMouse(tb.X1,tb.Y2);
   wait(1000)
   MoveMouse(tb.X1,tb.Y1);
   wait(1000)
end;

begin
 SetupClientVM1;
 SetupClientVM2;
 SetupRatios;
 SetupBoxesVM1;
 SetupBoxesVM2;
 MoveMouseAroundTBox(ClientVM1,VM1TB);
 MoveMouseAroundTBox(ClientVM2,VM2TB);
end.

 

- - - Updated - - -

 

Also, after the clients are setup, if I put IE or something over the windows, the mouse moves in the places on the IE window over the two targeted windows. The placeholders in the taskbar start flashing orange when the MoveMouseAroundTBox is called like they are being activated, but they are not brought to the front of the screen, but the mouse placement is correct...

 

- - - Updated - - -

 

program MultipleClientTest;
 var  
   Wnds: THwndArray;
   ClientVM1,ClientVM2 : TSCARWindowClient;
   VM1Width, VM1Height : Integer;
   VM2Width, VM2Height : Integer;
   VM1TB,VM2TB : TBox;
   TBoxX1,TBoxX2,TBoxY1,TBoxY2 : Single;  
const
   VM1Title = 'MEmu 2.1.1 - MEmu_1'; 
   VM2Title = 'MEmu 2.1.1 - MEmu_2';
   //VM1Title = 'test1 - Notepad'; 
   //VM2Title = 'test2 - Notepad';
   Debug = True;
   DebugMsgWait = 500;          
procedure DebugInfo(msg : String);
begin
 WriteLn(msg);
 Wait(DebugMsgWait);
end;
procedure SetupClientVM1;
begin
 If Debug Then DebugInfo('Setting Up Client VM1.');  
 //Wnds := FindWindowsPreg(GetDesktopWindow,'MEmu 2.1.1 - MEmu_1 .*','', False);
 //Wnds := FindWindowsPreg(GetDesktopWindow,VM1Title,'', False);
 Wnds := FindWindows(VM1Title);
 WriteLn(Wnds[0]);      
 ClientVM1 := TSCARWindowClient.Create(Wnds[0]);
 SetClient(ClientVM1); 
 ClientVM1.Activate;    
 ClientVM1.ClientArea := True;
 VM1Width := ClientVM1.ImageArea.X2 + 1;
 VM1Height := ClientVM1.ImageArea.Y2 + 1;    
end;
procedure SetupClientVM2;
begin
 If Debug Then DebugInfo('Setting Up Client VM2.');  
 //Wnds := FindWindowsPreg(GetDesktopWindow,'MEmu 2.1.1 - MEmu_2 .*','', False);      
 //Wnds := FindWindowsPreg(GetDesktopWindow,VM2Title,'', False);      
 Wnds := FindWindows(VM2Title);      
 WriteLn(Wnds[0]);      
 ClientVM2 := TSCARWindowClient.Create(Wnds[0]);
 SetClient(ClientVM2); 
 ClientVM2.Activate;    
 ClientVM2.ClientArea := True;
 VM2Width := ClientVM2.ImageArea.X2 + 1;
 VM2Height := ClientVM2.ImageArea.Y2 + 1;    
end;
procedure SetupRatios;
begin
 If Debug Then DebugInfo('Setting Up Ratios.');
   //Screen Percentages    
   TBoxX1 := 0.1;
   TBoxX2 := 0.9;
   TBoxY1 := 0.1;
   TBoxY2 := 0.9;
end;
function CreateTBox(X,Y : Integer; RX1,RY1,RX2,RY2 : Single) : TBox;
var tb : TBox;
   X1,X2,Y1,Y2 : Integer;
begin
 If Debug Then DebugInfo('Setting Up Box.');
   X1 := Floor(X * RX1);
   X2 := Floor(X * RX2);
   Y1 := Floor(Y * RY1);
   Y2 := Floor(Y * RY2);
   tb := Box(X1,Y1,X2,Y2);
   WriteLn(BoxToStr(tb));
   Result := tb;
end;
procedure SetupBoxesVM1;
begin
 If Debug Then DebugInfo('Setting Up Boxes VM1.'); 
 VM1TB := CreateTBox(VM1Width,VM1Height,TBoxX1,TBoxY1,TBoxX2,TBoxY2);
end;
procedure SetupBoxesVM2;
begin
 If Debug Then DebugInfo('Setting Up Boxes VM2.'); 
 VM2TB := CreateTBox(VM2Width,VM2Height,TBoxX1,TBoxY1,TBoxX2,TBoxY2);
end;
procedure MoveMouseAroundTBox(Client : TSCARWindowClient; tb : TBox);
begin
   If Debug Then DebugInfo('Moving Mouse!'); 
   SetClient(Client);
   Client.Activate;
   Client.ClientArea := True; 
   MoveMouse(tb.X1,tb.Y1);
   wait(1000)
   MoveMouse(tb.X2,tb.Y1);
   wait(1000)
   MoveMouse(tb.X2,tb.Y2);
   wait(1000)
   MoveMouse(tb.X1,tb.Y2);
   wait(1000)
   MoveMouse(tb.X1,tb.Y1);
   wait(1000)
end;

begin
 SetupClientVM1;
 SetupClientVM2;
 SetupRatios;
 SetupBoxesVM1;
 SetupBoxesVM2;
 MoveMouseAroundTBox(ClientVM1,VM1TB);
 MoveMouseAroundTBox(ClientVM2,VM2TB);
end.

 

- - - Updated - - -

 

The above works with notepad but not MEmu VMs... :(

Edited by DuByD
spelling
Link to comment
Share on other sites

Yeah I tested it... (frownyface) I am actually able to get focus of the window now by using FindWondow but tried this as well... The problem is that after you set and activate the client now, the mouse doesn't move unless you click on something outside of scar and you have to do it on each client as it switches... If you don't touch the mouse, it just sits there... It works fine with regular windows, I was just trying a new emulator called MEmu because it allows multiple instances... Where I had used virtualbox in the past. Virtualbox is great, but need a newer android image to run the game I am working on. The great thing about the older versions of android in virtualbox is that it didn't capture your mouse which makes scripting easy when switching between many VMs. The newer versions capture the mouse and you have to escape the mouse before switching VMs and it makes getting in and out of them troublesome... MEmu doesn't capture the mouse as others do. Very interesting emulator but I don't think the issue is with the script but maybe how MEmu emulator controls its windows.... So might just be out of luck and have to keep trying with VBox some more to see if I can get around the screen capture like you could with the ice cream version of android...

Link to comment
Share on other sites

if you dont want to play full screen only window mode u can click to maximize window or use ddraw and edit ddraw.ini
change width and height from there and restart game. u dont need to use widescreen for this maybe with normal resolution window will be bigger
Link to comment
Share on other sites

オンライン カジノは、プレイヤーが自宅にいながらにしてポーカー、ルーレット、ブラックジャック、スロットなどのギャンブル ゲームを楽しむ機会を提供する仮想プラットフォームです。 オンラインカジノは、アクセスのしやすさ、ゲームの種類の多さ、そして大金を獲得する機会があるため、年々人気が高まっています。

オンラインカジノの主な利点は、利便性とアクセスしやすさです。 プレイヤーは、通常のカジノの営業時間に制限されず、いつでもゲームを楽しむことができます。 必要なのは、インターネットにアクセスできるデバイスと、カジノのウェブサイトにアクセスできることだけです。 これにより、プレイヤーは従来のカジノによくありがちなストレスや緊張を感じることなく、快適な環境でプレイすることができます。

オンラインカジノのもう1つの利点は、ゲームの選択肢が豊富なことです。 ユーザーは、それぞれ独自のルールと勝利の機会を提供する何百もの異なるゲームから選択できます。 技術革新のおかげで、オンライン ゲームのグラフィックとサウンドは高品質になり、プレイヤーは興奮と情熱の雰囲気に浸ることができます。

さまざまなゲームに加えて、オンライン カジノはプレーヤーにさまざまなボーナスやプロモーションも提供します。 これらは、スロットのフリースピン、プレイのための追加のお金、または貴重な賞品が得られる特別なトーナメントなどです。 このようなボーナスにより、勝利の可能性が高まり、ゲームがさらに楽しくなります。

もちろん、オンラインカジノでのプレイにはリスクがあります。 ギャンブルには依存性がある可能性があるため、自分の感情を監視し、支出をコントロールすることが重要であることを覚えておくことが重要です。 カジノはまた、責任あるゲーミングをサポートし、自己排除や賭け金制限の機会を提供します casimaru.com

全体として、オンライン カジノはギャンブル愛好家にとって便利でエキサイティングなエンターテイメントを提供します。 幅広いゲーム、ボーナスの選択肢があり、いつでもプレイできるため、世界中のプレイヤーの間で人気が高まっています。 ただし、責任あるゲームと、ゲームが単なる楽しみと娯楽の源であるように自分の行動を制御する能力について覚えておくことが重要です。
Link to comment
Share on other sites

crypto lawyer neon crypto price michael lewis crypto how long does simplex bitcoin buy take 4 bitcoins in dollars buying bitcoin in new zealand 1 bitcoin dollars crypto swaps nasdaq crypto custody bossa crypto zero1 pi crypto zeta token apply for crypto credit card how to buy bitcoin with interactive brokers

0.325327 bitcoin in usd buy bitcoin with bitcoin cash doges coin agencia investir bitcoin rs crypto com wallet address chase exchange coins why is shiba inu going up today what is a burn in crypto instant crypto airdrop shiba tradingview

ord io buy cannabis online bitcoin advantages of ethereum over bitcoin 4 what is the characteristics of bitcoin multi-select question dimensionx dun crypto 0056 bitcoin to usd 2021 crypto games buy bitcoin with itunes balance ansem crypto

league of legends next game mode 0.7 bitcoins to dollars celr adopt bitcoin shop crypto accept crypto nyc purchasing bitcoins cryptocurrency is dead a crypto system could be classified generally as accounting crypto

buy yacht with bitcoin 11 of americans own bitcoin how long does it take to mine a bitcoin passive gaming crypto cities
Link to comment
Share on other sites

adГіzГЎs a bitcoin utГЎn buy cars bitcoin ethersan pkt crypto buying bitcoin with zcash buy bitcoin with unverified paypal bitcoincash wallet 1m bitcoin 0g crypto buy crypto using credit card 0.00047458 bitcoin is how much usd dogecoin token cylum burning crypto how to mine pepe coin

bitcoins colombia what time will bitcoin halving happen pixel vault buy bitcoin through payza 3 bitcoin to naira shiabinu 2080 crypto mining how to buy bitcoin on binance p2p r/pulsechain crypto payment gateway development

solanaconda buying bitcoin with square 10 000 bitcoin worth github crypto bitcoins customer service crypto mobi gekkohq buy bitcoin with qr code 10 euros to bitcoin acheter crypto.com coin

40 bitcoins to gbp cheapest way to buy bitcoin canada buy bitcoin with debit card instantly reddit how to buy bitcoin using etoro round your answers to two decimal places. eclipsefi ada future price okx token celeb dump cuГЎntos bitcoin tiene el salvador

1ezs92k4xjbymdlwg4f7pnf5idpe62e9xy bitcoin can i buy bitcoins instantly when does cell and frieza come to fortnite buy bitcoin atm fees alt coin
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...