Leaderboard
Popular Content
Showing content with the highest reputation on 07/20/2017 in all areas
-
These bugs have escaped my attention. The cure is good enough but can be streamlined: MsgBox(0, "", _StringProper3("đây là dòng chữ tiếng_việt chuẩn")) MsgBox(0, "", _StringTitleCase3("đây là dòng chữ tiếng_việt chuẩn")) Func _StringProper3($s) Return(Execute("'" & StringRegExpReplace(StringLower($s), "(*UCP)\b(\p{Ll})", "' & StringUpper('$1') & '") & "'")) EndFunc Func _StringTitleCase3($s) Return(Execute("'" & StringRegExpReplace(StringLower($s), "(*UCP)(?<=\PL)(\p{Ll})", "' & StringUpper('$1') & '") & "'")) EndFunc2 points
-
HighMem - Maximise your RAM access on x64
argumentum reacted to RTFC for a topic
Please answer me these questions three, ere the other side you see: Are you running a 64-bit machine with a 64-bit Windows operating system? Can your AutoIt scripts cope with having directive #AutoIt3Wrapper_UseX64=Y, and thus @AutoItX64=True? Are you sick and tired of seeing this error message? If you (like me) answered "YES" to all three questions, then the _HighMem library may ease your pain (the name commemorates a useful utility from the days when CPUs were still steam-powered). Forget about pathetic boot switches /3GB and /userva; in a full-fledged 64-bit environment, _HighMem can pre-allocate all available physical/virtual RAM you've got (or any smaller size you need), and manage individual allocations therein with four simple functions: _HighMem_StartUp( $nSize, $sUnit="GB" ) ; parse size of total region to pre-allocate, e.g. (10,"GB") _HighMem_Allocate( $nSize, $sUnit="B" ) ; returns $pOffset (new allocation's base address) _HighMem_Release( $pOffset ) ; existing allocations are identified by their offset (base address) _HighMem_CleanUp() ; close handles, release all pre-allocated memory Of course, existing AutoIt limitations remain in force (e.g., DllstructCreate() is still limited to 2 GB per call), but the maximum of 2-4 GB of virtual memory per Windows process can (under the right circumstances, in the proper environment) be circumvented. However, this is the first beta release, so glitches are likely, and performance may vary. In fact, it may not work at all for you (if you're running 32-bit, for example). And since this involves your own hardware, it's unlikely I would be able to reproduce your issues in my own work environment. Nevertheless, if you find obvious bugs or mistakes in the code, please do post. And if it works for you, that's also good to hear. My own motivation for developing it was to supercharge my matrix computing environment (Eigen4AutoIt), so it can handle matrices of any size that fit in machine RAM. The attached zip contains the library itself (HighMem.au3) and two test examples. HighMem_Test1 performs a dry run stress test of the allocation management system; it does not actually do any memory I/O. By contrast, HighMem_Test2 pre-allocates a 6 GB space, stores 3 x 2GB structs there, performs some basic I/O, and releases the allocations one by one. Obviously, for this to work you'll need at least that much free RAM to begin with (check with Task Manager -> Performance -> Memory if you're unsure). My own test environment has 16 GB of physical RAM, and runs W10Pro/64. EDIT: minor edits added to improve user experience (many more status messages if $_HighMem_Verbose=True) HighMem.v0.85.7z EDIT: from beta version 0.9, HighMem supports shared memory, including mutex negotiation. HighMemv0.9.2.7z1 point -
Do you mean that it can't handle filenames with these special characters? The UDF itself is using the standard windows com object "Shell.Application" to unzip, so not much that can be changed there. Jos1 point
-
Beginner Question - Filepath - change letters - search for specific data
Mag91 reacted to FrancescoDiMuro for a topic
@Mag91 First of all, don't say these things Everyone starts from the basic, and, within time, improve himself with the right path... Then, let's talk about the approach you'd like to implement with your script. I saw that you're opening the Excel worksheet to copy the row of the file to "format" ( xxxx_xxxxx_xxxx ), but, why don't using an _Excel* function? You already know the name of the Excel file, so you could open it ( without see anything ), load the content of the file in an array ( with _Excel_RangeRead() ), and work on the content of the array, instead of having windows which activate and copy-paste data from program to program. I can point you to the right direction ( which could be a lot, so my "solution" could not be the best/the only one you have to do... ), but you have to decide how to proceed with your script.1 point -
Super Cool App Launcher, with BAGS of features.
DjDiabolik reacted to TheDcoder for a topic
I can understand why you have posted in this thread @DjDiabolik, generally it is frowned upon to resurrect which have died long ago, It's best if you open a new thread1 point -
Beginner Question - Filepath - change letters - search for specific data
Mag91 reacted to FrancescoDiMuro for a topic
Hi @Mag91, and welcome to the AutoIt forum What you're trying to do is: 1) Read from an Excel worksheet; 2) You have a string, which it's lenght is 13 characters, and, after 4 characters, you have to put an underscore ( "_" ), then, after other 5 characters, you have to put another "_" ( after the 9th character, so ); 3) You have to shell these combined paths ( for me, it's not needed the Shell(), and search for PDF files in them, and those PDF files have the first 15 characters which are always the same, copy them to the Desktop folder. Not so difficult to do Did you test some code? Show us what you got1 point -
This has been already discussed in Trac, for instance: https://www.autoitscript.com/trac/autoit/ticket/29141 point
-
I'm happy if it helps you. I'm not exactly sure what the difference is between _StringProper() and _StringTitleCase().1 point
-
I am aware of the limitations. I can and I do (edit : although not by appending .0)! MsgBox(0, "", 1.0e+099 + 90) No significant issues here! Edit: Converting hard coded large integers won't work without the use of strings though. I just try to avoid overflow on calculations - only making conversions when needed. Some kind of warning is a good idea in any event.1 point
-
@czardas, Converting out of range integers into floats isn't doable, as it opens a whole new big can of worms. For instance what would the following code do? Local $MyBigInt = 999999999999999999900 ConsoleWrite($MyBigInt & @LF) $MyBigInt += 90 ConsoleWrite($MyBigInt & @LF & @LF) For $i = $MyBigInt To $MyBigInt + 9 ConsoleWrite($i & @LF) Next I've canned distinct issues here and none can be solved by floats. Have fun making the initial value a float by appending .0 Similar issues can arise in otherwise legal and inconspiciously wrong code: Local $MyBigInt = 9223372036854775000 ; this initial value can come from Jove or user or ... ConsoleWrite($MyBigInt & @LF) $MyBigInt += 8 ConsoleWrite($MyBigInt & @LF & @LF) For $i = 1 To 9 ConsoleWrite($MyBigInt + 100 * $i & @LF) Next Very few languages offer guards against integral under- overflow and the only serious way out is to support arbitrary-size integer arithmetic out of the box. That or flag invalid constants at check time and warn the programmers that integers must fit in a signed int64.1 point
-
I have very little time to look at this in any detail right now, However here is a quick modification to _StringProper(). MsgBox(0, "", _StringProper2("đây là dòng chữ tiếng_việt chuẩn")) Func _StringProper2($sString) Local $bCapNext = True, $sChr = "", $sReturn = "" For $i = 1 To StringLen($sString) $sChr = StringMid($sString, $i, 1) Select Case $bCapNext = True If StringRegExp($sChr, '(*UCP)[\w]') Then $sChr = StringUpper($sChr) $bCapNext = False EndIf Case Not StringRegExp($sChr, '(*UCP)[\w]') $bCapNext = True Case Else $sChr = StringLower($sChr) EndSelect $sReturn &= $sChr Next Return $sReturn EndFunc ;==>_StringProper You, or someone else, might be able to improve on this. Look at the change in the RegExp from the original function. You might also want to capitalize words which are joined with underscore. Func _StringProper2($sString) Local $bCapNext = True, $sChr = "", $sReturn = "" For $i = 1 To StringLen($sString) $sChr = StringMid($sString, $i, 1) Select Case $bCapNext = True If StringRegExp($sChr, '(*UCP)[\w]') Then $sChr = StringUpper($sChr) $bCapNext = False EndIf Case Not StringRegExp($sChr, '(*UCP)[\w]') Or StringRegExp($sChr, "[_0-9]") ; now underscore/numbers also trigger capitalization $bCapNext = True Case Else $sChr = StringLower($sChr) EndSelect $sReturn &= $sChr Next Return $sReturn EndFunc ;==>_StringProper _StringTitleCase() will also need looking at. I don't have time today. Edit : Modified 2nd version.1 point
-
I'm not sure what's best and would be happy either way. I do think a warning is appropriate. If the interpreter were to reject these values, then there would be every reason to report an error. As things are, it's a bit unclear if this behaviour really is by design. If not then it ought to be a bug.1 point
-
mmm I see. Edit: I think by default is false. But You could do it this way. change true to false. :-P ConsoleWrite(">GET METHOD USING IMAGE URL<" & @CRLF) _GetMethodTest() ConsoleWrite(">POST METHOD UPLOADING LOCAL IMAGE<" & @CRLF) _PostMethodTest() Func _PostMethodTest() Local Const $sAPIKey = '8f1e0a750088957' Local $sBoundary = "--------Boundary" Local $sHeaders = "Content-Type: multipart/form-data; boundary=" & $sBoundary & @CRLF Local $sData = '' Local $sFileName = "OCR.png" Local $sFilePath = @ScriptDir & "\" & $sFileName Local $hFile = FileOpen($sFilePath, 16) ;16=$FO_BINARY Local $sFileData = FileRead($hFile) FileClose($hFile) $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="file"; filename="' & $sFileName & '"' & @CRLF $sData &= 'Content-Type: application/octet-stream' & @CRLF & @CRLF $sData &= BinaryToString($sFileData, 0) & @CRLF $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="language"' & @CRLF & @CRLF $sData &= "eng" & @CRLF $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="isOverlayRequired"' & @CRLF & @CRLF $sData &= 'true' & @CRLF $sData &= "--" & $sBoundary & "--" & @CRLF Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "https://api.ocr.space/Parse/Image", False) $oHTTP.SetRequestHeader("Content-Type", "multipart/form-data; " & "boundary=" & $sBoundary) $oHTTP.SetRequestHeader("apikey", $sAPIKey) $oHTTP.Send(StringToBinary($sData, 1)) Local $sReceived = $oHTTP.ResponseText ConsoleWrite($sReceived & @CRLF) EndFunc ;==>_PostMethodTest Func _GetMethodTest() Local Const $sAPIKey = '8f1e0a750088957' Local $sReturn = InetRead('https://api.ocr.space/parse/imageurl?apikey=' & $sAPIKey & '&isOverlayRequired=true&url=http://i.imgur.com/fwxooMv.png', 1) ;1=$INET_FORCERELOAD $sReturn = BinaryToString($sReturn) ConsoleWrite($sReturn & @CRLF) EndFunc ;==>_GetMethodTest Saludos1 point
-
1 point
-
trouble reading div tags
BrianTheLibrarian reacted to Danyfirex for a topic
Hello. Try this: #include <IE.au3> Local $oIE = _IECreate() Local $sHTML=FileRead("test.html") ;your html file path here _IEDocWriteHTML($oIE, $sHTML) _IEAction($oIE, "refresh") Local $oInfo=_IEGetObjByClass($oIE,"info") Local $oName=_IEGetObjByClass($oIE,"name") Local $oLicense=_IEGetObjByClass($oIE,"license") ConsoleWrite("Info: " & _IEPropertyGet($oInfo,"innertext") & @CRLF) ConsoleWrite("Name: " & _IEPropertyGet($oName,"innertext") & @CRLF) ConsoleWrite("License=: " & _IEPropertyGet($oLicense,"innertext") & @CRLF) Func _IEGetObjByClass(ByRef $o_object, $s_Class, $i_index = 0) If Not IsObj($o_object) Then __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidDataType") SetError($_IEStatus_InvalidDataType, 1) Return 0 EndIf ; If Not __IEIsObjType($o_object, "browserdom") Then __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidObjectType") SetError($_IEStatus_InvalidObjectType, 1) Return 0 EndIf ; Local $i_found = 0 ; $o_tags = _IETagNameAllGetCollection($o_object) For $o_tag In $o_tags If String($o_tag.className) = $s_Class Then If ($i_found = $i_index) Then SetError($_IEStatus_Success) Return $o_tag Else $i_found += 1 EndIf EndIf Next ; __IEConsoleWriteError("Warning", "_IEGetObjByClass", "$_IEStatus_NoMatch", $s_Class) SetError($_IEStatus_NoMatch, 2) Return 0 EndFunc ;==>_IEGetObjByClass Saludos1 point -
Retrieve Task Scheduler History
mLipok reacted to JLogan3o13 for a topic
You could do something like this to check the last time your task ran (works, but no error checking): Local $oService , $rootFolder, $oTasks, $iNum, $sName, $sState = 0 $oService = ObjCreate("Schedule.Service") $oService.Connect() $rootFolder = $oService.GetFolder("\") $oTasks = $rootFolder.GetTasks(0) $iNum = $oTasks.Count If $iNum = 0 Then ConsoleWrite("No Tasks Found" & @CRLF) Else ConsoleWrite($iNum & " tasks found:" & @CRLF) For $sTask in $oTasks Switch $sTask.State Case 0 $sState = "Unknown" Case 1 $sState = "Disabled" Case 2 $sState = "Queued" Case 3 $sState = "Ready" Case 4 $sState = "Running" EndSwitch ConsoleWrite("For task " & $sTask.Name & ", status is: " & $sState & " " & $sTask.LastRunTime & @CRLF) Next EndIf Edit: I just noticed you mentioned successful runs, you could get this with the .LastTaskResult. You could do something like: If $oTask.LastTaskResult <> 0 Then ...1 point -
Imagebutton with Transparent GUI
coffeeturtle reacted to Champak for a topic
Figured it out, $GUI_Resume_Zoom = GUICreate("Resume Zoom", 35, 35, 555, -78, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED), $GUI_GOOGLE_MAIN) GUISetBkColor(0xFFFFFF) GUICtrlCreatePic($AppPathImages & "\FocusOff.gif", 0, 0, 35, 35) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetOnEvent(-1, "_AutoZoom_Resume") _WinAPI_SetLayeredWindowAttributes($GUI_Resume_Zoom, 0xFFFFFF, 255) GUISetState()1 point