ravenfyre
Active Members-
Posts
76 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
ravenfyre's Achievements
Wayfarer (2/7)
0
Reputation
-
Hey guys I'm doing a realtime screen capture recording the desktop screen. I need to record mouse and key statistics too. So on the bottom I want window spy to run in one corner to display the mouse position, and in the other corner somekind of key event displayer showing which key is pressed at that time. Problem is I can't figure out how to get a key logger to display on screen either by writing a script or using a 3d party application. All these key loggers run in the background which is useless. Scriptwriter is exactly what i'm looking for except once the first page is full with the log, it doesn't scroll down automatically to display the current key press making future review on the desktop video recording useless. I'm sure someone has come accross somekind of 3rd party application that displays what keys are pressed on the screen. Any suggestions guys? Thanks.
-
It's been a while since I used AutoIT to work on a project. In fact I think it's been almost 2 years. I see quite a few things have changed, the implementation of a GUI for one which actually I think will come in handy with my new project. I need some advice on how to start my new project with the use of a GUI. I may need multiple GUI's but that's what I need help on to determine how many I need. You see the project is relatively simple, my friends and I will be working on developing one of those interactive board games. I'm sure some of you played them. You pop in a VCR or DVD, play the board game and on the TV it'll give you commands for your next action. I plan to replace the TV with the PC, create our own commands and set them to appear randomly so it doesn't get repetetive. What I need is the following. First, a real-time countdown timer at the top of the screen. This timer may be affected by the command, either jump forward or backward. Second the actual command screen on the bottom which will show pre-written commands randomly throughout the game until the timer reaches 0. Next these commands will trigger audio and video which will display in the centre of the screen. The video clips are all AVI files I will prepare in 3d animation software. Since the countdown clock has to be realtime I'm thinking it has to be a seperate script. Since the clock will be affected by certain commands from the main script they obviously have to talk to eachother. As far as I know it is still not possible in AutoIT to have 2 scripts talk to eachother besides reading the title names of the windows. This may have changed so if I am wrong please correct me. So I'm thinking of setting this up as two scrips with two GUI's filling the screen. One on the top with the clock, and one filling the remainder of the screen that will display the command text on the bottom. When needed the command will trigger the video file which will play in the larger (command) GUI and will display the video in the middle. So you have the clock at the top, video in the middle and command text on the bottom. I'm hoping this will work and that 3 GUI's will not be necessary, the 3rd being for the video itself. As long as I know how to set this up using these GUI's I can easily proceed from there. I just want to start off right so if you guys have some suggestions please let me know. Thanks in advance for any advice you can give.
-
Thanks JdeB for replying. Well I guess no cheap shortcuts, having to read all the text first (WinGetText) is the only way it would seem ^^.
-
Is there any way to make AutoIt read specific text from a window? Finding a key like iniread or more simple yet reading a line like filereadline? WinGetText is great but if the text is long and I start messing around splitting it up and using stringinstr to search for a specific key then it will get processor intense if I need it to be done quickly and frequently. I'm sure there must be something like winreadline, or something with a similar function which I may have overlooked in the help file.
-
I have a string that returns an array. The number of delimeters vary from 3 to 6 and the first 2 delimeters are not important for the function and are excluded. I have a For-Next loop, and how many times it will loop depends on how many delimeters are in the array, subtracted by 2 because as I said the first 2 are not important here. Currently inside the loop I have it select the delimeters in order starting with the 3rd. I don't want to do this though. I need the script to select one of the delimeters, not in any order. I thought of using the random function but the problem with random is sometimes it picks the same number as before. Since this loop ONLY loops as many times as there are delimeters-2, this is unacceptable. I need within each loop to pick a delimeter, but as I said not in any order and it cannot select one twice. An example of a string that's being split into an array might be 0,0,1,2,3. In this example it will loop 3 times, selecting either 1,2 or 3. I don't want it in any order. 2,1,3 3,2,1 1,2,3 3,1,2 etc. For $count=1 to $con[0]-2; loops as many times as there are delimeters-2 $num = $con[$count+2]; selects the next delimeter(this one in order) The loop is definitely what's throwing me off, any suggestions would be greatly appreciated.
-
StringinStr, search from right not working
ravenfyre replied to ravenfyre's topic in AutoIt General Help and Support
Hmm that's kinda odd. Oh well I guess that would be the easy way out ^^. -
Howdy folks. I'm using StringinStr and would like to search from the right, instead of the left. Taken directly from the help file, "Use a negative occurance to search from the right side." Unfortunately it doesn't work, I still get results from the left hand side of the string. Just run my simple example and see. StringInStr ( "string", "substring" [, casesense [, occurance]] ) $test = "3,2,1" $num = 1; $check = StringInStr($test,$num,0,-1); msgbox(0, "test", "should be 1: "&$check); It should be 1, not 5, if it searched from the right. A bug, or am I overlooking something?
-
Q1) How to merge strings, each a part of the whole
ravenfyre replied to ravenfyre's topic in AutoIt General Help and Support
Ah, good info, thanks guys. Doh! Didn't even consider using EndFunc. All those endless hours starring at my monitor trying to finish my script has fried my brain lol -
Hey fellas, I got a couple questions. Hopefully someone can help me out a bit :"> Question #1: How would I go about merging several strings? Normally the answer would be easy, but what if each of these strings is only a part of the whole and if one part of it already exists in another it should be overwritten. One could start at the beginning and cut off in the middle, another in the middle cut off at the end and one could just be the middle of the whole string. Take the following as an example. $string1 = "1,2,3" $string2 = "3,4,5" $string3 = "2,3,4,5" $string4 = "5,6,7" therefore, the complete string is: "1,2,3,4,5,6,7" The numbers in the string are ALWAYS in the same order, they just start and end at different places, therefore I need to merge them to get the complete string. I am puzzled at how to go about doing this . Question #2 I thought I might aswell stick in another quicky question. Is there any other way than using "return" to exit a function, so the script will continue? Is using "return" the only method? I know it will work but just wanted to know if there is another way.
-
Global variables being destroyed within Function
ravenfyre replied to ravenfyre's topic in AutoIt General Help and Support
Ah now I get it. You learn something new everyday. Actually that makes 2 things today ^^. Thanks again guys. -
So it looks like my compass problem is nearing a solution(other post), but a new function I have added is not behaving as expected. I tried to test a similar function seperately to find the same behaviour. Global variables can be altered from anywhere, but Function variables are destroyed the moment the function ends. I use global variables within functions all the time, I just don't know why this one is affected. In this function the global variable is altered within the function. Surely after the function is called the modified values should show up but that's not the case. Even after the function, which modifies these global variables, these variables are still the same as before the function was called. Below is a test script. It changes both test_nums from a value of 0 to 50. The msgbox should return the modified value since it's after the function call, but it instead returns the non-modified value. This leads me to conclude these global variables are acting as function variables and are destroyed the moment the function ends. $test_num1 = 0; $test_num2 = 0; calc($test_num1,$test_num2); msgbox(0, "test", $test_num1&","&$test_num2); Func calc($test_num1,$test_num2); If $test_num1 = 0 Then $test_num1 = 50; EndIf If $test_num2 = 0 Then $test_num2 = 50; EndIf EndFunc
-
Need help with a stubborn simulated compass
ravenfyre replied to ravenfyre's topic in AutoIt General Help and Support
Hmm, that little trick may work. If turning right within Quadrant 2, about to make the transition to 0deg, the script will think the target is larger then 360deg. A target angle of 10deg would be 370deg. Same for turning left within Quadrant 1, the target angle will be smaller then 0, or negative. Good thinking, I'll try to test this method now. Thanks this-is-me. Thanks Nutster, never considered the MOD function a viable solution. Actually, I never used it before ^^. I'll surely read up on it now after you proposed the idea. -
Need help with a stubborn simulated compass
ravenfyre replied to ravenfyre's topic in AutoIt General Help and Support
Certainly, here ya go. It's only the part of the script I have trouble with. I didn't want to post the whole thing for a couple reasons. First, it's incredibly long and still disorganized so figuring what does what wouldn't be easy for someone just looking at it ^^. Secondly, I'm trying to focus on getting help on just this one part, I don't want you guys to waste your time going about fixing the rest of my errors lol. First let me explain the variables and functions used: $global_gdeg - is the goal or target angle specified by the user cdeg() - returns the current angle of the compass $global_turn - specifies which way the compass should rotate (left,right,none) Buttons used Numpad6 to rotate compass right Numpad4 to rotate compass left When target angle and current angle is > 25, key is held down for full rotation speed When target angle and current angle is < 25 and > 15, key is tapped quickly to slow down (the closer to target angle, the slower the tapping) When target angle and current angle is < 15, key is tapped slowly (the closer to target angle, the slower the tapping) Enough chit chat, here's the code that slows down the rotation. Do Sleep(2); $diff = $global_gdeg - cdeg(); determines the difference between your target angle and current If $diff < 0 Then $diff = -($diff); makes the difference positive EndIf If $global_turn = "right" Then $key = 6; ElseIf $global_turn = "left" Then $key = 4; EndIF If $diff > 25 Then; if greater then 25deg, hold button $count = 0; If $global_turn = "right" Then Send("{NUMPAD4 up}"); Send("{NUMPAD6 down}"); ElseIf $global_turn = "left" Then Send("{NUMPAD6 up}"); Send("{NUMPAD4 down}"); ElseIf $global_turn = "none" Then Send("{NUMPAD4 up}"); Send("{NUMPAD6 up}"); EndIf ElseIf $diff <= 25 AND $diff > 15 Then; tap button fast, depending on how close Send("{NUMPAD4 up}"); Send("{NUMPAD6 up}"); $count = $count + 1; Sleep($count); If $global_turn <> "none" Then Send("{NUMPAD"&$key&"}"); EndIf ElseIf $diff <= 15 Then; tap button slow, depending on how close Send("{NUMPAD4 up}"); Send("{NUMPAD6 up}"); $count = (2499-(99*$diff))/24; Sleep($count); If $global_turn <> "none" Then Send("{NUMPAD"&$key&"}"); EndIf EndIf Until $diff <= 1; compass stops within a 1deg difference EndFunc As I said, this works great but anywhere except in the norther region of the compass where angle is changed from 360deg to 0deg. This sudden angle change, although being the same angle realisticly, confuses the function of the script because it's looking to slow down when it gets close to the target angle. Unfortunately the numbers 360 and 0 are far from each other and that's what the script thinks, where realisticly they are the same. So when it comes close to 0deg, it slows down and bam once it passes 0deg the current angle becomes 35X and instead of slowly rotating back it will speed up because it will think the target angle is further then it really is. Hope that makes sense ^^. I'm currently thinking of using radians instead of degrees but damn not only I hate working with radians but I gotta rework my entire script and calculations lol. That might fix my problem though, I'm not sure as I always try to avoid radians =). -
I know I have written a lot, but I tried to be as clear as possible. Please don't let that discourage you from reading I'm working on a project, to create a realistic simulated compass. Instead of pointing to North though, it points to an angle specified by the user. This is actually part of a larger project I will work on once I learn C++, but for now I just want to get familar with programming a compass with a language I know. Currently not everything will be done in AutoIt as it doesn't support some features, at least I don't think. I asked a friend of mine who is good with C++ if he could create for me a visual compass, which will rotate depending on the commands used and variables provided by my AutoIt script. To make things simple, the AutoIt script will copy the variables into the clipboard and the little visual compass proggy will read the clipboard and do what's required. My friend told me he could do everything for me in C++, but I told him that's not the point as I wanted to learn myself the equations needed to automate a compass. Equations don't change from one language to the next, so I can easily transfer them over to C++ once I learn it. My friend won't be back until Tuesday, so for now I have the pleasure of watching numbers on my screen instead of a nice visual compass lol. So far the compass works great, but there is a bug I can't get around. I may have put too much effort into making this lol. I added a nice little feature, but it came with a side effect and at one point I was so frustrated I was thinking of removing he additional code . Of course I realized that removing code is not a solution as a programmer. The feature I've implemented to simulate a realistic compass is a little hard to explain. I'm not sure if you guys noticed it on a compass but the pointer never directly goes North. Instead it wobbles a bit left and right before settling towards North. Ya well that's what I did and at one point it's causing problems. The script is written to make the compass slow down before reaching the target angle. The closer it is to the target, the slower it will rotate. Because of the feature I have described above, it will pass the target and rotate the other direction, pass it again, rotating back and then finally settling at the angle specified. Here's the problem, this does not working very well when the target angle is near North, or 0 or 360deg. I have specified the script to start slowing down the rotation when within 25deg of the target angle. For instance, if the target angle is 180deg, it will slow down starting at 155deg or 205deg depending which way it's rotating, left or right. The compass always rotates in the direction the target angle is closest to. All is well but what if the target angle is 0deg or 360deg, which both are the same angle. See the problem here? It will start slowing down from either 25deg or 335deg. Once it passes it's target angle and spin the other direction due to the little feature I implemented, it will check how close it is within range of the target angle and adjust the rotation speed acordingly. If my target angle is 0deg and the compass is rotating left, it will pass the 0deg mark and the current angle will now be 359deg or something around it. It will try to check the range again but the numbers 0 and 359 are no where near within a range of 25, even if on a compass we see the angles to be within the same range. AutoIt now mistakenly will speed up the rotation in the opposite direction, flying way past the target angle until it figures it somehow past it again and will rotate back again. Because of the 0 and 360deg confusion, the script will never think it's within a range of 25deg once it passes true North(0deg or 360deg) so it will never fully slow down and settle. As for now, the compass wobbles like mad especially around at true North(0deg). Because of the 25 range specification, the bug effects any target angle from 335deg and 25deg, so relatively in the Northern area. I have no idea how to counter this 0deg or 360deg confusion. Hopefully someone here who maybe has some experience programming a working compass may suggest some ideas how to make the script know even though it passes true North, it's still close and within range of the target angle which is nearby. Mucho Gracias for any help on this.
-
Displaying Text File As Msgbox
ravenfyre replied to ravenfyre's topic in AutoIt General Help and Support
Just what I needed, thank you "this-is-me".