2 posts in this topic
Howdy, this is my first post, massive fan of autoit.
I've searched and tried and I would just like people who are better at this than me to let me know if this is even a thing.
I'd like to perform just a variable. For example, it would be. *see inserted code*
So what i'm wanting is, create the constant $test, and that variable would be what is followed after the = . Then perform the _FileCreate. Then perform the variable. Logically or in my head rather.. That variable is declared and is equal to what it is set to above, therefore just placing the variable plainly in the script, it should be equal to what it was declared as. So what am I doing wrong, and or how can I have autoit just perform the variable.
#include <File.au3> Const $test = FileWriteLine(@DesktopDir & "\Log.txt", @CRLF ) _FileCreate(@DesktopDir & "\Log.txt") $test
I have a script , during compilation and test execution, it worked perfectly but sometimes I am getting error as "Variable used without being declared."
I understood somewhere in the branching logic this is happening.
But not able to find it exactly.
As I am using multiple include statements.the line number is also not giving accurately.
Can anyone suggest what is the approach to resolve this?
I have previously used _IEFormElementGetObjByName and _IEFormElementSetValue to enter text into a search box on a form and then submit the form.
I am now trying to enter text into a search box which is not part of a form.
Here is the HTML from the website that i'm trying to enter the data on and then submit the search.
<div class="form-group col-xs-12">
<span id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_lblSearchText" for="input-search">Registreringsbeteckning</span>
<div class="input-group col-xs-12">
<span id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_preSearchText" class="input-group-addon">SE -</span>
<input name="ctl00$FullWidthWithSubmenuContent$FullWidthContent$MainContent$AircraftRegistry$txtSearchText" type="text" value="DTH" id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_txtSearchText" class="form-control" />
<div class="form-group col-xs-12">
<label class="sr-only" for="">Sök</label>
<input type="submit" name="ctl00$FullWidthWithSubmenuContent$FullWidthContent$MainContent$AircraftRegistry$btnSearch" value="Sök" id="FullWidthWithSubmenuContent_FullWidthContent_MainContent_AircraftRegistry_btnSearch" class="btn btn-primary ladda-button" data-style="expand-right" />
Many thanks in advance
I have a requirement to return both a string and an array from a function so as a result I put them both into an array and returned that. I can access them in their entirety after returning them but then I can't seem to access the array elements after this. Should I be able to or is there a prettier way?
#include <Array.au3> ;Memory info returned as a string and an array $memoryInfo = _getMemoryInfo() msgbox(0,"Memory Info",$memoryInfo) _ArrayDisplay($memoryInfo,"Memory as an Array") Local $newArray $memoryInfo = $newArray msgbox(0,"Test element",$newArray) _ArrayDisplay($newArray) Func _getMemoryInfo() Local $newArray Local $array = MemGetStats() $newArray = $array ;% of memory in use $newArray = Round($array/1024 * 0.001,2) ;Total physical RAM $newArray = Round($array/1024 * 0.001,2) ;Availaible physical RAM $newArray = Round($array/1024 * 0.001,2) ;Total pagefile $newArray = Round($array/1024 * 0.001,2) ;Available pagefile $newArray = Round($array/1024 * 0.001,2) ;Total virtual $newArray = Round($array/1024 * 0.001,2) ;Available virtual $memoryUsage = $newArray - $newarray $pagefileUsage = $newArray - $newarray ;Output/Return Local $returnArray $returnArray = "Memory: " & $memoryUsage & " GB/" & $newArray & " GB " & @CRLF & "Pagefile: " & $pagefileUsage & " GB/" & $newArray & " GB " $returnArray = $newArray return $returnArray EndFunc A bit messy but hopefully it's understandable what I'm trying to achieve.
Hello all! I have had some issues reading text from different types of windows, occasionally, specifically with controlgettext.
**Before I begin, I know there are better ways to do what I attempt in the example below. That's not the point of this post. The point is my issues with controlgettext.
I am about to cite an example with an application you may be familiar with called SpeedFan (v4.52). My problem is not specific to speedfan, it is simply the most recent and easily reproducible example I can think of.
So, the goal of the script below is to get a string of text containing the current fan RPMs from the highlighted control in the screenshot below (see "speedfan_control_details.png").
Now, here's a simple script for grabbing the window handle and reading the text from that control:
$wintitle = "SpeedFan 4.52" $controlID = "197934" ;will be reformatted as "[ID:######]" $hwnd = wingethandle($wintitle) if @error<>0 then msgbox(0, "WinGetHandle", "FAILURE. @error="&@error) Exit EndIf $text = ControlGetText($hwnd, "", "[ID:"&$controlID&"]") if @error=1 then msgbox(0, "ControlGetText", "FAILURE. @error="&@error) ;failure returns "" and @error=1 Exit EndIf msgbox (0, "ControlGetText", "SUCCESS. @error="&@error &@CRLF& "$text="&$text) ;success returns string and @error=0 You'll see that the ControlGetText operation runs without error, however it does not capture any text from the control. If you explore the other controls in this one window, you'll find mixed results across the board. Neither the temps nor voltages can be read, while the log field and some other elements can be read. Even when you read the text from the whole window, those elements are not included in the visible nor hidden texts.
I have run into this issue many times in the past- inconsistencies in the ability of autoit to interact with certain controls. What is it which makes this text different than any other readable texts? Is there an alternate method of reading the text in the window/control which could work? Any and all info to help me solve this mystery and satisfy my curiosity would be greatly appreciated.
Thanks -Rob C
PS: Running Autoit v188.8.131.52 on Win7 Ultimate x64