JQadrad 0 Posted July 29, 2010 Hello, This is my first post and I'm quiet new to AutoIt. I've been using AutoHotKey for a few years now in combination with WinLIRC to control my music/lamps/video. But now I'm working on a project which has nothing to do with the AutoHotKey script I already have. The short story: I need to make a program which reads data from the movement of a cell phone and converts it to a keystroke. The long story: For a school project I need to make the controls for Pong played on a 3D LED-cube. At this moment the controls are done by up/down/left/right and A/S/D/W. I want to make a keyboard replacement with the cell phone. On the cell phone I need to use the accelerometer to know the movement of the cell phone. At this moment I'm working with my own phone with Symbian 3rd. I have a script on my cell which connects with the accelerometer, writes the x and y value of it to a file 'player1.txt' and then sends it via bluetooth. The program I've made in AutoIt reads the player1.txt, first line and second line, resp. x and y-movement and displays them. Then I can choose to enable the keyboard output, so it simulates the keystroke. When you are moving your cell phone up, the program should simulate 'Up' etc. But! The problem is that in my program I constantly open en close player1.txt in my while loop. When I want to send the file player1.txt from my cell to my notebook, it gives an error. Probably because the file is open on my notebook so I have no right to write to that file on the same moment. Is there a way I can avoid this problem? I.e. by keeping the file open while I'm in the while-loop? Can anybody help? I hope my problem is clear, if not, just ask me =) Thanks in advance, JJ Share this post Link to post Share on other sites
happy2help 0 Posted July 30, 2010 My idea would be to send a file from the phone called "left.txt" when you move left and then the PC scans a folder for either "left.txt","right.txt",etc and when it finds one it executes it. That way the phone sends a stream of left, right, up, downs to the PC and the PC reads the name of the file and deletes it immediately ready for the next to be sent. I use a similar setup at home, it scans a folder for a list of files and then reacts to a file appearing and then deletes the file, waiting for the next to appear. Share this post Link to post Share on other sites
JQadrad 0 Posted August 1, 2010 So instead of reading what is in the file, you change the name of the file according to the motion. So you don't need to open the file on your computer.. I will give it a try. Share this post Link to post Share on other sites