-
Posts
19 -
Joined
-
Last visited
Profile Information
-
Location
Germany (at the moment Australia)
Recent Profile Visitors
revonatu's Achievements

Seeker (1/7)
0
Reputation
-
Do ... Until ... Static8 contains ...
revonatu replied to revonatu's topic in AutoIt General Help and Support
Clear case of not to see the wood for the trees. Thank you for the fast answer.- 2 replies
-
- stringinstr
- do
-
(and 1 more)
Tagged with:
-
general and specific GUI questions
revonatu replied to revonatu's topic in AutoIt GUI Help and Support
"best" meaning most time and code efficient -
Hi guys, I didn't find an answer to my problem in other do until topics, that's why I am here. I need to pause my script until the text in a static control changes to something like "File prepared" or "New image". Here is what I tried: Do Sleep(500) $Status = ControlGetText("Prepare and Resize", "", "[CLASS:Static; Instance:8]") Until StringInStr($Status, "prepared") > 0 AutoIt doesn't like it after "Until" and complains: Statement cannot be just an expression. Is there another way to say that a word shall be included in a static control? Glad for help.
- 2 replies
-
- stringinstr
- do
-
(and 1 more)
Tagged with:
-
general and specific GUI questions
revonatu replied to revonatu's topic in AutoIt GUI Help and Support
Of course! I could have come to that idea by myself. My script is full of error checking but in this case I forgot. There was just a bracket in the filter missing. Thanks a lot. I would still like to know if the loop mode is best for my case. Could I use the event mode as well? If yes, how? -
general and specific GUI questions
revonatu replied to revonatu's topic in AutoIt GUI Help and Support
I don't know why but now it worked indeed. Maybe I included some needed package for other reasons. I would still like to know if the loop mode is best for my case. Could I use the event mode as well? If yes, how? After not doing many changes one of my combo boxes (operation mode --> GUI) won"t open a FileOpenDialog anymore. Can you reproduce this? I can"t find an error. Global $metaPath = "" Global $posPath = "" Global $bsqPath = "" Global $innPath = "" Global $DEMPath = "" ;#cs GUI Creation ################################################################################################################################ Local $AutoIt_GUI = GUICreate("Initial Settings", 500, 300) ; title, width and height Local $idLabel0 = GUICtrlCreateLabel("Wellcome to this automation. Please choose your preferences.", 30, 10) ; text and position (left, top) Local $idButton1 = GUICtrlCreateButton("*.meta file", 30, 50, 60) Local $idLabel1 = GUICtrlCreateLabel("Select the meta file with start and end time in lines 1 and 2.", 150, 55, 300, 60, 0x0002) ; right-aligned Local $idButton2 = GUICtrlCreateButton("*.pos file", 30, 80, 60) Local $idLabel2 = GUICtrlCreateLabel("Select the pos file with geometry.", 150, 85, 300, 60, 0x0002) ; right-aligned Local $idCombo1 = GUICtrlCreateCombo("operation mode", 30, 150, 100) GUICtrlSetData($idCombo1, "GUI|.inn file", "operation mode") Local $idLabel3 = GUICtrlCreateLabel("Select an operation mode and the corresponding input file.", 150, 155, 300, 60, 0x0002) ; right-aligned Local $idCombo2 = GUICtrlCreateCombo("terrain type", 30, 200, 100) GUICtrlSetData($idCombo2, "Flat|Rugged", "terrain type") Local $idLabel4 = GUICtrlCreateLabel("Select a terrain type and in case of rugged terrain a DEM.", 150, 205, 300, 60, 0x0002) ; right-aligned Local $idBExit = GUICtrlCreateButton("Exit", 400, 250, 60); name, position (l t) and width GUICtrlSetColor($idBExit, $COLOR_RED) Local $idBRun = GUICtrlCreateButton("Run", 30, 250, 60) GUICtrlSetColor($idBRun, $COLOR_GREEN) Sleep(1000) GUISetState(@SW_SHOW) ; display the GUI WinWaitActive("ATCOR4 - Initial Settings") ; In this message loop we use variables to keep track of changes to the GUI controls ======================================================== While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE , $idBExit ; when pressed, cancel and exit the script GUIDelete($AutoIt_GUI) Case $idButton1 ; when pressed, open the meta file selection, save and display the path in Label1 $metaPath = FileOpenDialog("Select the meta file...", @ScriptDir, "Meta (*.meta)") GUICtrlSetData($idLabel1, $metaPath) Case $idButton2 ; when pressed, open the pos file selection, save and display the path in Label2 $posPath = FileOpenDialog("Select the pos file...", @ScriptDir, "Pos (*.pos)") GUICtrlSetData($idLabel2, $posPath) Case $idCombo1 ; when pressed, save the selection as variable $OperationMode = GUICtrlRead($idCombo1) If $OperationMode = "GUI" Then $bsqPath = FileOpenDialog("Select the bsq file...", @ScriptDir, "BSQ (*.bsq") GUICtrlSetData($idLabel3, $bsqPath) ElseIf $OperationMode = ".inn file" Then $innPath = FileOpenDialog("Select the initialisation file...", @ScriptDir, "inn (*.inn)") GUICtrlSetData($idLabel3, $innPath) Else GUICtrlSetData($idLabel3, "The operation mode is not set yet. Please do so to continue.") EndIf Case $idCombo2 ; when pressed, save the selection as variable $TerrainType = GUICtrlRead($idCombo2) If $TerrainType = "Rugged" Then $DEMPath = FileOpenDialog("Select the DEM...", @ScriptDir, "DEM (*.bsq;*.grd))") GUICtrlSetData($idLabel4, "Rugged, DEM: " & $DEMPath) ElseIf $TerrainType = "Flat" Then GUICtrlSetData($idLabel4, $TerrainType) Else GUICtrlSetData($idLabel4, "The terrain type is not set yet. Please do so to continue.") EndIf Case $idBRun ; when pressed, return to script and continue ExitLoop EndSwitch WEnd WinClose("Initial Settings") -
general and specific GUI questions
revonatu replied to revonatu's topic in AutoIt GUI Help and Support
Yes, some things work, but why does the Window not close when pressing the x Button in the upper right corner? How do I get back to my script and how do I pause it for the time the GUI is open. WinWaitActive and -Close? -
Hi, I have a quite complex script and now I would like to define the initial parameters and directories via a GUI. The first question is: Which GUI mode is best for my purposes? I don't understand in detail what the difference is. I tend to OnEvent mode as I only need the GUI at the beginning. Edit: Ok, only in loop mode the file selection works. One question solved. But how do I pause my script and start it after I am done with the GUI? This is my code so far: #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <FileConstants.au3> #include <StringConstants.au3> #include <Date.au3> #include <Array.au3> #include <GUIConstantsEx.au3> Local $AutoIt_GUI = GUICreate("ATCOR4 - Initial Settings", 500, 400) ; title, width and height Local $idLabel0 = GUICtrlCreateLabel("Wellcome to this ATCOR4 automation. Please choose your preferences.", 30, 10) ; text and position (left, top) Local $idButton1 = GUICtrlCreateButton("*.meta file", 30, 50, 60) Local $idLabel1 = GUICtrlCreateLabel("select the meta file with start and end time", 120, 55, 300, 60) Local $idButton2 = GUICtrlCreateButton("*.pos file", 30, 80, 60); name, position and width Local $idLabel2 = GUICtrlCreateLabel("select the pos file with flight geometry", 120, 85, 300, 60) Local $idCombo1 = GUICtrlCreateCombo("Operation Type", 30, 150, 100) GUICtrlSetData($idCombo1, "GUI|.inn file", "Operation Type") Global $OperationMode = '"' & GUICtrlRead($idCombo1) & '"' GUISetState(@SW_SHOW) ; display this GUI Local $idMsg = 0 ; In this message loop we use variables to keep track of changes to the GUI controls While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Exit ;Case $GUI_EVENT_MINIMIZE ;MsgBox($MB_SYSTEMMODAL, "", "Dialog minimized", 2) ;Case $GUI_EVENT_MAXIMIZE ;MsgBox($MB_SYSTEMMODAL, "", "Dialog restored", 2) Case $idButton1 Local $MetaOpenDialog = FileOpenDialog("Select the meta file...", @ScriptDir & "\", "Meta (*.meta)") $metaPath = $MetaOpenDialog GUICtrlSetData($idLabel1, $MetaOpenDialog) Case $idButton2 Local $PosOpenDialog = FileOpenDialog("Select the pos file...", @ScriptDir & "\", "Pos (*.pos)") $posPath = $PosOpenDialog GUICtrlSetData($idLabel2, $PosOpenDialog) EndSwitch WEnd Thanks in advance for any hints and suggestions (the shorter the code the better).
-
Finding and reading a specific line in big CSV
revonatu replied to revonatu's topic in AutoIt General Help and Support
I reduced the resolution to one line per second, which is enough for my needs and now I can read it to an array and pick my variables. Here is my well working code (blowen up by error requests): If Not _FileReadToArray ($posPath, $Pos, 4, " ") Then msgbox(16, "error", "Failed to read file. Error: " & @error) Exit EndIf Local $LineX = _ArrayBinarySearch ($Pos, Round($MeanTime,0), 0) If Not @error Then ;MsgBox(64, "Found", "LineX= " & $LineX, 2) ; e.g. row 5200 Else msgbox(16, "Error", "Error: " & @error) Exit EndIf Local $ArrayX = _ArrayExtract($Pos, $LineX, $LineX) ; extract the desired row to a new array If Not @error Then ;_ArrayDisplay($ArrayX, "ArrayX", "", 96, Default, "TimeOfDay (UTC)|PosLat (deg)|PosLon (deg)|PosHeight (m)|AngleRoll (deg)|AnglePitch (deg)|Heading (deg)", 2) Else msgbox(16, "Error", "Error: " & @error) Exit EndIf $Lat = _ArrayUnique($ArrayX, 1); $ArrayX[1] If Not @error Then ; _ArrayDisplay($Lat) Else msgbox(16, "Error", "Failed to extract. Error: " & @error) EndIf $Lon = _ArrayUnique($ArrayX, 2); $ArrayX[2] ;$Elev = _ArrayUnique($ArrayX, x); $ArrayX[x] $Alt = _ArrayUnique($ArrayX, 3); $ArrayX[3] $Head = _ArrayUnique($ArrayX, 6); $ArrayX[6] Thanks for your help. -
Finding and reading a specific line in big CSV
revonatu replied to revonatu's topic in AutoIt General Help and Support
I only need to read it once in this AutoIt session. -
revonatu reacted to a post in a topic: StringRegExp: extract Date from Pathname
-
revonatu reacted to a post in a topic: Finding and reading a specific line in big CSV
-
Finding and reading a specific line in big CSV
revonatu replied to revonatu's topic in AutoIt General Help and Support
@boththose BTW it has to be 250 x $n as one second consists of ca. 250 lines. So far so good, but to get the difference between the two times I'd have to reformat them to hh-mm-ss which costs time again. Otherwise only the first digits in front of the ':' are taken into account for the subtraction which doesn't help. Oh, I was wrong. No need to reformat. Fine. Next Question. I only know and found the functions FileRead and FileReadLine. Both don't work for several lines in the middle of a file. How do I read my $X +/-1000 lines? -
Finding and reading a specific line in big CSV
revonatu replied to revonatu's topic in AutoIt General Help and Support
@boththose Nice idea! But to select the 50 lines before and after the desired time I needed to know their numbers. Then we come full circle. Using AutoIt: By now I opened the CSV file with Notepad and "Found" (Ctrl F) the desired Time. Afterwards I selected and copied that line. Now I try to pick my variables out of this line via StrRegExp. Not elegant, but at least it works more or less and doesn't take too long. If someone has more elegant ideas, please share them with me. -
Finding and reading a specific line in big CSV
revonatu replied to revonatu's topic in AutoIt General Help and Support
Thanks for the suggestions so far. I hoped it would be easier. Here are some more details on my data: The 167 MB table contains the the coordinates of a whole flight day. Within this day I need the mean value of a single flight line. I calculated the mean time from start and end time of that stripe (saved in another file) and now I need the coordinates at that time. Read only. Date (UTC),Time (UTC),TimeFromStart (s),PosLat (deg),PosLon (deg),PosAlt (m), 28/01/2015,01:36:44.010,0.000,-36.78730154,158.63387961,19.397 28/01/2015,01:36:44.014,0.004,-36.78730154,158.63387961,19.397 28/01/2015,01:36:44.018,0.008,-36.78730154,158.63387961,19.397 .... As you can see the changes in time are slight and continuously increasing. The date remains the same. As an example the given time would be 03:03:23.071. As this task is only a preparing piece of puzzle within a long AutoIt process I would prefer to solve it within AutoIt. -
Hi, I have a big CSV file with 1,864,653 lines with the following variables: Date (UTC),Time (UTC),TimeFromStart (s),PosLat (deg),PosLon (deg),PosAlt (m), ... 28/01/2015,01:36:44.010,0.000,-36.78730154,158.63387961,19.397, ... ... I want to find the line whose UTC Time is closest to a given one (stored as variable) in the same format (hh:mm:ss.sss). When found the line I want to extract the Lat, Lon and Altitude values. How can I do this and at the same time avoid reading the whole file, which is too big and would cost much processing time? Thanks for hints and ideas.
-
Calculating the average of two UTC times
revonatu replied to revonatu's topic in AutoIt General Help and Support
For my special problem I just found the solution: Avaraging the GPS seconds before calculating hours minutes and seconds! It's so simple. Anyway, thank you for your help. Your suggestions might be helpful in an other case. -
Calculating the average of two UTC times
revonatu replied to revonatu's topic in AutoIt General Help and Support
Hi Tekk, Thank you for your answer. The point is I spent quite a lot of code to get from GPS seconds to hours, minutes and seconds, that I need as separate variables later on $StartTime = FileReadLine($metaPath, 1) $StartTime = StringMid($StartTime, 19, StringLen($StartTime)-20) ; GPS Time (Seconds) from meta file $SHour = ($StartTime/3600) $SMinute = ($SHour - Floor($SHour))*60 $SSecond = ($SMinute - Floor($SMinute))*60 $EndTime = FileReadLine($metaPath, 2) $EndTime = StringMid($EndTime, 17, StringLen($EndTime)-18) ; GPS Time (Seconds) from meta file $EHour = ($EndTime/3600) $EMinute = ($EHour - Floor($EHour))*60 $ESecond = ($EMinute - Floor($EMinute))*60 $Hour = ($SHour+$EHour)/2 $Minute = ($SMinute+$EMinute)/2 $Second = ($SSecond+$ESecond)/2 I hoped there would be a final function in AutoIT as in Excel. Before I define an own function, it's faster to source this step out to Excel. So please no more suggestions for user defined functions.