Jump to content

herbgoat

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by herbgoat

  1. I made a workaround by seperating my script into 2 seperate files and having the first script launch the second. It works this way but I'm not really sure why. The only bad thing is I have to have the second script as an exe so it adds a step during editing. Thanks for your input.
  2. Make sure you are using Beta by using the toggle function located in C:\Program Files\AutoIt3\beta\Extras I had a similiar problem after I downloaded Beta but I was not actually using Beta until I toggled it on.
  3. GioVit, Thanks for your suggestions. I have tried both of them and still no luck. I added the FileClose and reopen and also gave it a little sleep time. I also tried telling it to read line 1. Any more ideas? Here is my latest attempt. $sabrecopy = ClipGet() FileWriteLine($timefile, $sabrecopy) FileClose($timefile) Sleep(300) FileOpen($timefile, 0) $parsetime = FileReadLine($timefile, 2) FileClose($timefile) $parsetime = StringStripWS ($parsetime, 1)
  4. Actually, I suppose it's a problem with the FileReadLine function instead of the FileWrite function since c:\time.txt is being created no problem. Edit: You beat me to it in you're previous post. Thanks.
  5. I originally had that in the script but I took it out after reading this... http://www.autoitscript.com/forum/index.php?showtopic=29486 It doesn't work either way.
  6. I can't figure this one out. I have a script that will ask for the time off of a terminal emulator and then parse the result into the format the _DateDiff command uses. Then it should tell me how many seconds between the requested time and actual time. I have the script written but FileReadLine always returns blanks to the $parsetime variable. If I remove FileReadLine and let the second script run by itself it works. The first script leaves everything blank: $parsetime, $smo, $sday, $shour, etc... Any ideas? (I'm using beta) This script works... #include "File.au3" #include "String.au3" #include "Misc.au3" #include "Date.au3" $starttime = "2006/08/02 01:00:00" $timefile = FileOpen("c:\time.txt", 0) If $timefile = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $parsetime = FileReadLine($timefile, 2) FileClose($timefile) $parsetime = StringStripWS ($parsetime, 1);strips leading white space // begin time parse $parsetime = StringTrimLeft ($parsetime, 16) $smo = StringLeft ($parsetime, 2) $parsetime = StringTrimLeft ($parsetime, 3) $sday = StringLeft ($parsetime, 2) $parsetime = StringTrimLeft ($parsetime, 7) $shour = StringLeft ($parsetime, 2) $parsetime = StringTrimLeft ($parsetime, 2) $smin = StringLeft ($parsetime, 2) $parsetime = StringTrimLeft ($parsetime, 3) $ssec = StringLeft ($parsetime, 2) ;end time parse ; $waitsec = _DateDiff( 's',@YEAR & "/08/01[ 23:18:[00]]",@YEAR & $smo & "/" & $sday "[ " & $shour & ":" & $smin & ":[" & $ssec & "]]" ) $waitsec = _DateDiff( 's',@YEAR & "/" & $smo & "/" & $sday & " " & $shour & ":" & $smin & ":" & $ssec,$starttime) MsgBox(4096, "Result", "The time difference is: " & $waitsec) This script returns blanks... #include "File.au3" #include "String.au3" #include "Array.au3" #include "Misc.au3" #include "Date.au3" Dim $line[5] $starttime = "2006/08/02 10:30:00" ;enter time to find difference from If NOT FileExists("C:\drop.txt") Then MsgBox(4096, "", "c:\drop.txt data does not exist.") Exit EndIf If WinExists("MyApp") Then Opt("MouseCoordMode", 0) Opt("SendKeyDelay", 1) $countlines = _FileCountLines("C:\drop.txt") $timefile = FileOpen("C:\time.txt", 2);begin time check from terminal If $timefile = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf WinActivate("MyApp") MouseClick ("left", 50, 240, 1, 0) Send ("{BS}" & "'t" & "{ENTER}") Sleep(1000) Send ("^a") Send ("^c") $sabrecopy = ClipGet() FileWrite($timefile, $sabrecopy) ; by this point in the script the file is successfully created ;I have also tried FileWriteLine for the above command. $parsetime = FileReadLine($timefile, 2) FileClose($timefile) $parsetime = StringStripWS ($parsetime, 1);strips leading white space // begin time parse $parsetime = StringTrimLeft ($parsetime, 16) $smo = StringLeft ($parsetime, 2) $parsetime = StringTrimLeft ($parsetime, 3) $sday = StringLeft ($parsetime, 2) $parsetime = StringTrimLeft ($parsetime, 7) $shour = StringLeft ($parsetime, 2) $parsetime = StringTrimLeft ($parsetime, 2) $smin = StringLeft ($parsetime, 2) $parsetime = StringTrimLeft ($parsetime, 3) $ssec = StringLeft ($parsetime, 2) ;end time parse $waitsec = _DateDiff( 's',@YEAR & "/" & $smo & "/" & $sday & " " & $shour & ":" & $smin & ":" & $ssec,$starttime) MsgBox(4096, "Result", "The time difference is: " & $waitsec) $file = FileOpen("C:\drop.txt", 0) $log = FileOpen("C:\droplog.txt", 1) For $I = 1 to $countlines ; looped commands go here Next FileClose($file) FileClose($log) else MsgBox(4096, "", "Error: can't find MyApp window.") EndIf Exit Here is the text file with the time that I'm parsing... ¥T« CENTRAL TIME IS 08/02 214 1538.06¶ Any ideas/input are greatly appreciated.
  7. I had the same problem and this worked for me. Thanks lopolop!!!
  8. Part of the problem is that the MouseClick command makes the mouse click on the specified coordinates not wait for the user to click the mouse. I've already used MouseClick in my script for another task. The problem is I need to manually edit the program for each person's computer to define where that button is located. I would like the program to find out for itself by saying, "click on the next button now." Then you click and it remembers where that was. Then later in the program I can use MouseClick to go click that "next" button on the webpage again.
  9. I don't want to create a button. I'm writing a script that will click on a certain button on the screen (in Internet Explorer). I have 2 problems. 1. The button will not be the same place each time depending on each individual computer due to screen size and resolution. I want to make this compatible with other people's computers. 2. The button is a graphic that changes names each time it is pressed so I can't just go off the name of the link. I just had a thought that I can go off the name of the graphic... "next.gif" I'll give that a shot. Thanks.
  10. I'm new and would appreciate any help for what should be a simple question. I need my script to record the cursor position on a mouse click. I have found the command "MouseGetPos" but I need something to go with it to tell the script to MouseGetPos when the left button is pressed. Example... $cursorpos = OnMouseClick MouseGetPos() Except there seems to be no command "OnMouseClick" Any help?
×
×
  • Create New...