-
Posts
13 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
alexandruc's Achievements

Seeker (1/7)
4
Reputation
-
alexandruc reacted to a post in a topic: Delete line in file based on 2 conditions
-
elmoi0010 reacted to a post in a topic: Click witout name or id?
-
Hi, is the following working? $oTDs = _IETagnameGetCollection($oIE, "input") For $input in $oTDs If String($input.value) = "Login" Then _IEAction($input, "click") ExitLoop EndIf Next
-
Hello, Based on what I read here and on google I put together the following code: Func atan2($y, $x) Return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y)))) EndFunc Func new_coords($lat,$long,$distance,$dir) $earthRadius = 6371 $lat1 = _Radian($lat) $lon1 = _Radian($long) $bearing = _Radian($dir); $lat2 = asin(sin($lat1) * cos($distance / $earthRadius) + cos($lat1) * sin($distance / $earthRadius) * cos($bearing)) $lon2 = $lon1 + atan2(sin($bearing) * sin($distance / $earthRadius) * cos($lat1), cos($distance / $earthRadius) - sin($lat1) * sin($lat2)) return _Degree($lat2)&","&_Degree($lon2) EndFuncThe function receives as input the current location (for example: 48.4456 , 2.298889) the distance in km and the bearing (0,90,180 etc) for which to generate new GPS coordinates. However, for some reason, in certain cases (I guess due to moving on the map, and passing geographical parallels?) the new coordinates are wrong and just overlap older coordinates. This doesn't happen all the time so I have no idea what's wrong. Can anyone tell me if my function is wrong by design and maybe point me in the right direction (maybe if there already is such an UDF I couldn't find...)? Thank you EDIT: pffff... Sorry, wrong forum section. can a mod please move it to the right place? Sorry again
-
Internet Explorer javascript
alexandruc replied to hendrikhe's topic in AutoIt General Help and Support
Hi hendrikhe, In order to automate values from IE you need to read the page and get the contents of certain elements from the page. Just by looking at the page you will not be able to this. You need to look at the source of the page and identify the HTML elements that contain the text you want to read/get/copy/etc. For example you can use firebug in firefox to inspect the document and get html output. Take a look at: https://www.autoitscript.com/autoit3/docs/libfunctions/_IECreate.htm (to open IE with Autoit and get a browser handler), https://www.autoitscript.com/autoit3/docs/libfunctions/_IEDocReadHTML.htm (to read the page source), https://www.autoitscript.com/autoit3/docs/libfunctions/_IEGetObjById.htm (to target the desired element - depending on how the page is written you may need to use the "_IEFormElementGetObjByName" function) and https://www.autoitscript.com/autoit3/docs/libfunctions/_IEAction.htm (in case you need to perform other action inside the browser). -
argumentum reacted to a post in a topic: Scroll overflowing <div> in IE
-
czardas reacted to a post in a topic: Scroll overflowing <div> in IE
-
Scroll overflowing <div> in IE
alexandruc replied to alexandruc's topic in AutoIt General Help and Support
To whoever might be interested, I found a solution: I used _IEDocInsertHTML with "afterbegin" to insert a <div id=x> at the top of the overflowing <div>. Then I used _IEAction with "scrollintoview" to simulate the pageup/scrollup and load the div. For $i = 1 To 20 _IEDocInsertHTML($theOverFlowingDiv, "<div id='scrolltome"&$i&"'></div>", "afterbegin") $scrollto = _IEGetObjById($theOverFlowingDiv, "scrolltome"&$i) _IEAction($scrollto, "scrollintoview") Sleep(4000) Next -
boy233, Is that the actual code you are using? I doubt your url is "PAGINA_ASPX" and the form on the page is called "FormASPX" or that the input field is called "textExample". If those were just mock up values, make sure that in your original script those names are accurate. If the names are accurate, do you get any console errors when running the script? What are you trying to accomplish? Read the page as you initialy stated? Or submit a form on the page as your posted code shows? If no errors are shown use consolewrite on _IEBodyReadHTML($oIE) in order to have a starting point in debugging your script. Edit: your console output suggest that the name of the formobject and its content do not exist. As I said, make sure the names are correct.
-
What is the problem? What's the error you get? Have you tried anything? If you haven't done anything yet, take a look at _IECreate (https://www.autoitscript.com/autoit3/docs/libfunctions/_IECreate.htm) and _IEBodyReadHTML (https://www.autoitscript.com/autoit3/docs/libfunctions/_IEBodyReadHTML.htm) and if you still have problems post your code here.
-
rony2006, first use GUICtrlRead to read the user input from your form (https://www.autoitscript.com/autoit3/docs/functions/GUICtrlRead.htm). Then you can either send the data to a web page (https://www.autoitscript.com/forum/topic/147621-http-get-and-post-request-as-simple-as-possible/) then process the data to mysql on the server side, or you can use the mysql UDF to remote connect to your db but this seems to be a lot more complicated procedure. If the script you are trying to build will be shared with other users it implies security risks as the db credentials will be inside the autoit script. So, if your not the only user of the script I would recommend you send the date to a page and then process the data as you see fit.
-
Scroll overflowing <div> in IE
alexandruc replied to alexandruc's topic in AutoIt General Help and Support
I cannot link to the page as it's a secure internal admin page. Also the HTML is useless: it's just a div containing other nested divs. There is a javascript that detects pageup and scrollup events and loads data (nested divs) into the overflowing div. I seen the 'scrollintoview' function, but it's useless since the div will not load other data unless it is paged or scrolled up. There is no element hidden from view that I can use to bring into focus. -
31290 reacted to a post in a topic: GuiCtrlRead issue?
-
If (GuiCtrlRead($GIDTechInput)) OR (GUICtrlRead($PassInput)) = "" ThenYour script evaluates the if and since it does read the input (GuiCtrlRead($GIDTechInput)) it returns true and the popup appears. just use: $GIDTechInput = GuiCtrlRead($GIDTechInput) $PassInput = GuiCtrlRead($PassInput) If $PassInput = "" OR $GIDTechInput = "" Then ... EndIFor If (GuiCtrlRead($GIDTechInput)) = "" OR (GUICtrlRead($PassInput)) = "" Thensorry, haven't noticed Melba23 answered already...
-
Scroll overflowing <div> in IE
alexandruc replied to alexandruc's topic in AutoIt General Help and Support
Yes, I did read the IE functions help file. I don't think I missed any of the applicable ones. I am extracting data from inside the div (reading everything I find there). The div contains log entries. Scrolling up the div loads older entries into the div so reading simply the HTML will not load all relevant entries and scrolling up (or paging up as I am doing now but it blocks the desktop until the script ends) is necessary to load older not into view entries. -
Hello, Is it possible to send scroll-up/scroll-down commands to an overflowing <div> inside a web page? Right now I am using focus on the respective <div> and then I send {PGUP} / {PGDN} commands. The problem with this approach is the changing focus that prevents anyone to use the desktop while the scripts are running. Is there another way to programmatically target the div and make it scroll (up or down) thus allowing the script to run in the background? Thank you.
-
Delete line in file based on 2 conditions
alexandruc replied to alexandruc's topic in AutoIt General Help and Support
@mikell thank you. I noticed the above code does not always perform as expected. For some reason it does not delete the last line in the file if the time condition is met. for example: 0x551849DDECF6296BE48EC5D8B6A664EF|2015/11/05 22:12:34 (past - delete) 0xDC16555CF6383AA0A134C6F3A8692D33|2015/11/05 06:10:34 (past - delete) 0xB8B383146356B6D24F0088CB10FF2A2D|2015/11/05 22:12:34 (past - delete) 0x6A9558A6DD80BE0F460C730458F3A9CD|2015/11/06 22:12:34 (present - do not delete) 0x850C2E164B00333E39CD4EC90D0AD1A4|2015/11/06 06:10:34 (present - do not delete) 0x570352966B1F47FD91C67C374A15E5BC|2015/11/05 21:12:34 (past - delete) running the script on the above file lines will not delete the last line: 0x570352966B1F47FD91C67C374A15E5BC|2015/11/05 21:12:34 (past - delete) even if all lines in the file are (past-delete) it will still keep the last line. This happens only if there is no blank (empty) line at the end of file. If i insert a blank line, the script performs as expected @Malkey, your code works perfectly no matter where and how the blank lines are found in the file. Thank you very much. Thank you both for the help. -
Hello, I got a .txt file that contains data (number of lines is dynamic) in the following format: "<md5 hash>|date time" Example: 0x6FE88F555378C1249DA1D96FE3F117FA|2015/11/05 20:12:34 0x88FEA58B1F1017E4BEAC8C855999D1D5|2015/11/05 21:22:34 0x71BD989277F0D67B2E8F7BBB4644F047|2015/11/05 21:42:34 0x135F7153C9C7137BF1F7265247A74AB3|2015/11/05 22:12:34 I want to read each line from file, explode/split the string by the "|" separator and if more then "x" seconds passed since the line's date/time, I want to delete the line and proceed to evaluate next line until EOF. Based on the examples and info I found on the this forum I put together the following code (which obviously is not working): $file = FileOpen("log.txt", 0) $text = FileRead($file) While 1 $lines = FileReadLine($file) If @error = -1 Then ExitLoop $l = StringSplit($lines, "|") $time_d = _DateDiff('s', $l[2], _NowCalc()) if $time_d > 600 Then $text = StringReplace($text, $lines, @CRLF) FileWrite($file,$text) EndIf WEnd FileClose($file)In PHP I would do the above task with the code below: $handle = fopen($scanf, "r"); if ($handle) { while (($line = fgets($handle)) !== false) {; $vals = explode("|",$line); $del_line = trim($vals[4]); //date if ($del_line < time()-86400){ $contents = file_get_contents($scanf); $contents = str_replace($line, '', $contents); file_put_contents($scanf, $contents); } } } fclose($handle);Can anyone help me find an working Autoit solution? Thank you