I'm working with UFT- HP with VBScript language and trying to use the function micCapsLockOff that turns the caps lock off.
The problem is that this fucntion sometimes works and sometimes not.
Why is that? may you help?
Thanks...
Follows the code example:
For Index = 0 To 60 Step 1
If WpfWindow("window").Exist(0) Then
WpfWindow("window").Activate
WpfWindow("window").Type micCapsLockOff
WpfWindow("window").Click
End If
Next
I got the solution, this is because I was debugging the code. When I just run it, it worked fine.
Related
I have written a programme which merges two 1D arrays containing names. I print the list of arr1, arr2 and arr3.
I am using Lazarus Free Pascal v. 1.0.14 . I was wondering if anyone knows how to break the results in the dos-like window because the list is so long that I can only see the last few names in the returned results. The rest go by too fast to read.
I know I can save the resuls to file and I also use the delay command, but would like to know if there is a way to somehow break the results or slow them down or even edit the output console?
I appreciate your help.
This isn't really a programming question, because your console application should output the values without pause. Otherwise your program would become useless if you ever wanted it to run as part of another pipeline in an automated fashion.
Instead you need a tool that you wrap around your program to paginate the output if, and when, you so desire. Such tools are known as terminal pagers and the basic one that ships with Windows is called more. You execute your program and pipe the output to the more program. Like this:
C:\SomeDir>MyProject.exe <input_args> | more
You can change the code of your loop in the following way:
say you print the results by the followng loop:
for i:=0 to 250 do
WriteLn(ArrUnited[i]);
you can replace it with:
for i:=0 to 250 do
begin
WriteLn(ArrUnited[i]);
if (i mod 25) = 24 then //the code will wait for the user pressing Enter every 25 rows
ReadLn;
end;
For the future please! post MCVE in your questions otherwise everyone has to guess what your code is.
I wrote an application using GMLIb a couple of years ago and it has been working up until yesterday.
I read the fix, got a key, recompiled the code with v1.5.4 and v1.5.5 and have the same result.
The code is caught in an endless loop at AfterPageLoaded
if First then
FGMMap.DoMap;
First is never true.
Is anyone else experience this problem.
XE7 on Win7 64
20/05/2017
Removed GMLib. Reinstalled.
Compiled and ran the Megademo and the result is the same. An endless loop at AfterPageLoaded.
Created a simple test program using GMMap component and the result is the same.
I've had the same issue, but it seems that it is solved now!It happened at users who had IE 8 version on their machines - but I don't really know, why...
What is important though, is updating the IE to the latest version solves the problem!
Not so much of an answer, but a very similar issue and - I think - a workaround.
Again, this only affects certain machines, most have IE10 installed. My issue is not that First is never true but that it is always true.
procedure TFMain.GMMapAfterPageLoaded(Sender: TObject; First: Boolean);
begin
if (First) and (PLCount = 0) then // was just if First then
begin
GMMap.DoMap;
BShowInfo.Enabled := True;
end;
Inc(PLCount);
end;
Altering GMMapAfterPageLoaded as above (initialising PLCount to 0 first) seems to give the DoMap call enough time to work properly
So, I am new to sikuli coding, I do not have much experience with python either, so for many of you this might be a silly question. My problem is that I am trying to pause the program for x seconds. I have tried these 2 ways but every time I am getting an error. Here is what I have tried to do:
import time
time.sleep(10)
Error I am getting: [error] SyntaxError ( "no viable alternative at input 'time'", )
=======
sleep(10)
Error I am getting: [error] SyntaxError ( "no viable alternative at input 'sleep'", )
I hope that someone can help me with my silly problem. I would really appreciate :) (also, sorry for the Bad English)
Thanks in advance!
sleep(10) is 100% correct for sikuli IDE for how to get your program to pause for 10 seconds, so here are a few thoughts:
That error can crop up for lots of different reasons, but a really common one--in Python, white space DOES matter, and indentation is often a huge culprit for errors like this. In the sikuli IDE, your loops have to be indented exactly 4 spaces ( = 1 tab), any more or less will throw this error. You can also check for some missing syntax like apostrophes or brackets, sometimes in the line preceding the one that's throwing the error.
In this particular case, sometimes the import statement is finicky. You could try from time import * instead of just import time. They're supposed to be equal, but they seem to behave differently to me sometimes.
If you're importing the 'time' module just to use in functions like sleep(i) and wait(i), then the import is unnecessary, because those functions just require you to supply an integer i that represents a number of seconds, and they do the rest as part of their built-in functionality.
Finally, if you find that 'import time' is the problem, I have found that the Sikuli IDE does not have native access to all of the possible modules to import. I have had lots of success with the datetime module, but I have never tried just the time module. You might switch to 'import datetime' and see if that helps...
I'm using the code below to reference a range in excel and put a value into them. The code works fine first time round but fails if i dot it again. I get the error message (see title). Below is my code, can anyone see any issues?
xlApp.Workbooks("JDE1.xlsx").Sheets("TempHours").Range(Cells(2, 18), Cells(Cells(ws.Rows.Count, 1).End(xlUp).Row, 18)).Value = Batch
I know it is an old question and I happen to land on this but I will still go ahead an answer it.
You need to fully qualify your cells object. Notice the DOT before cells()? One should always fully qualify the objects like you did for Sheets("TempHours").
With xlApp.Workbooks("JDE1.xlsx").Sheets("TempHours")
.Range(.Cells(2, 18), .Cells(.Cells(ws.Rows.Count, 1).End(xlUp).Row, 18)).Value = Batch
End With
Hope this helps future visitors.
I have just started a new version of my Crysis Wars Server Side Modification called InfinityX. For better management, I have put the functions inside tables as it looks neater and I can group functions together (like Core.PlayerHandle:GetIp(player)), but I have ran into a problem.
The problem is that the specified method to get the players' name, player:GetName() is being seen as an invalid method, when the method actually is completely valid.
I would like to know if using the below structure is causing a problem and if so, how to fix it. This is the first time I've used this structure for functions, but it is already proving easier than the old method I was using.
The Code:
Event =
{
PlayerConnect = function(player)
Msg.All:CenteredConsole("$4Event$8 (Connect)$9: $3"..player:GetName().." on channel "..player.actor:GetChannel());
System.LogAlways(Default.Tag.."Incoming Connect on Channel "..player.actor:GetChannel());
Event:Log("Connect", player);
end;
};
The below code works when I bypass the function and put the code directly where it's needed:
Msg.All:CenteredConsole("$4Event$8 (Connect)$9: $3"..player:GetName().." on channel "..player.actor:GetChannel());
System.LogAlways(Default.Tag.."Incoming Connect on Channel "..player.actor:GetChannel());
The Error:
[Warning] [Lua Error] infinityx/main/core.events.lua:23: attempt to call method 'GetName' (a nil value)
PlayerConnect, (infinityx/main/core.events.lua: 23)
ConnectScript, (infinityx/main/core.main.lua: 52)
OnClientEnteredGame, (scripts/gamerules/instantaction.lua: 511)
(null) (scripts/gamerules/teaminstantaction.lua: 520)
Any clarification would be appreciated.
Thanks :)
Well, as PlayerConnect is inside the table Event, and you are calling with a ":", add self as first arg in the function, like:
PlayerConnect = function(self, player)
Clearly, player in the first block of code is not the same as player in the second block of code. The problem must be that the caller of Event.PlayerConnect is not passing the same value.
To test that your Event.PlayerConnect function works, try this in the same place as your second block of code:
Event.PlayerConnect(player)
That should work as you expect.
So, the problem comes down to how Event.PlayerConnect is called without the second block of code. I'm not familiar with that game engine so I don't know how it is done. Perhaps reviewing the documentation and/or debugging that area would help. If you print(player) or call the equivalent log function in both cases, you should see they are different. If you can't run in a debugger, you can still get a stack trace with print(debug.traceback("Accessing player, who's value is: "..player)). If there is indeed some kind of table-based player object in both cases, you can try comparing their fields to see how they are different. You might need to write a simple dumping function to help with that.