Leaderboard
Popular Content
Showing content with the highest reputation on 01/15/2017 in all areas
-
Not at all. Refering to the same source as you, one can see that unary operators have higher priority than comparisons. Hence Not $var = '' evaluates to (Not $var) = ''2 points
-
Version 1.7.0.1
10,054 downloads
Extensive library to control and manipulate Microsoft Outlook. This UDF holds the functions to automate items (folders, mails, contacts ...) in the background. Can be seen like an API. There are other UDFs available to automate Outlook: OutlookEX_GUI: This UDF holds the functions to automate the Outlook GUI. OutlookTools: Allows to import/export contacts and events to VCF/ICS files and much more. Threads: Development - General Help & Support - Example Scripts - Wiki BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2020-02-09) None1 point -
I've been playing with these interfaces today. Everything seems to be fine, but you need to add some error checking to the callback functions, and the integer structure which contains indices of files to extract must be used properly. List all items: ; List all items ConsoleWrite( "All items:" & @CRLF ) Local $sName, $iSize, $isDir For $i = 0 To $iCount - 1 $oIInArchive.GetProperty($i, $kpidPath, $sName) $oIInArchive.GetProperty($i, $kpidSize, $iSize) $oIInArchive.GetProperty($i, $kpidIsDir, $isDir) ConsoleWrite($i & ". " & $sName & ", size = " & $iSize & " bytes" & ", isDir = " & $isDir & @CRLF) Next ConsoleWrite( @CRLF ) Extract WinAll\beholder.inf: ; Extract WinAll\beholder.inf DirRemove( $7zExtractDir, 1 ) DirCreate($7zExtractDir) $bCreateSubfolders = True $tIndices = DllStructCreate( "int[1]" ) DllStructSetData( $tIndices, 1, 7, 1 ) ; Pass error check info and flags to IArchiveExtractCallback_GetStream IArchiveExtractCallback_GetStream( 0, $tIndices, $bCreateSubfolders, 0 ) ; Extract files and folders from archive through $oIArchiveExtractCallback $hResult = $oIInArchive.Extract( $tIndices, 1, 0, $oIArchiveExtractCallback ) ConsoleWrite( "oIInArchive.Extract $hresult = 0x" & Hex( $hResult ) & @CRLF ) ConsoleWrite( @CRLF ) Extract WinAll, WinAll\beholder.inf and www.SamLab.ws.url: ; Extract WinAll, WinAll\beholder.inf and www.SamLab.ws.url DirRemove( $7zExtractDir, 1 ) DirCreate($7zExtractDir) $bCreateSubfolders = False $tIndices = DllStructCreate( "int[3]" ) DllStructSetData( $tIndices, 1, 0, 1 ) DllStructSetData( $tIndices, 1, 7, 2 ) DllStructSetData( $tIndices, 1, 9, 3 ) ; Pass error check info and flags to IArchiveExtractCallback_GetStream IArchiveExtractCallback_GetStream( 0, $tIndices, $bCreateSubfolders, 0 ) ; Extract files and folders from archive through $oIArchiveExtractCallback $hResult = $oIInArchive.Extract( $tIndices, 3, 0, $oIArchiveExtractCallback ) ConsoleWrite( "oIInArchive.Extract $hresult = 0x" & Hex( $hResult ) & @CRLF ) ConsoleWrite( @CRLF ) IArchiveExtractCallback_GetStream in IArchiveExtractCallback.au3: Func IArchiveExtractCallback_GetStream($pSelf, $index, $outStream, $askExtractMode) Static $tIndices, $iCount, $iIdx, $bSubfolders If $pSelf = 0 Then $tIndices = $index $iCount = DllStructGetSize( $tIndices ) / 4 $iIdx = 1 $bSubfolders = $outStream Return EndIf If $iIdx <= $iCount And $index = DllStructGetData( $tIndices, 1, $iIdx ) Then ConsoleWrite( "IArchiveExtractCallback_GetStream $index = " & $index & @CRLF) Local $sName $oIInArchive.GetProperty($index, $kpidPath, $sName) ConsoleWrite("IArchiveExtractCallback_GetStream $sName = " & $sName & @CRLF) If $bSubfolders Then Local $sSubFolder = StringLeft( $sName, StringInStr( $sName, "\", 0, -1 ) - 1 ) If Not FileExists( $7zExtractDir & "\" & $sSubFolder ) Then _ DirCreate( $7zExtractDir & "\" & $sSubFolder ) EndIf $oIOutStream = 0 DeleteObjectFromTag($tIOutStream) $oIOutStream = ObjectFromTag("IOutStream_", $tagIOutStream, $tIOutStream, Default, $sIID_IOutStream) $oIOutStream.AddRef() $oIStreamOut = SHCreateStreamOnFile($7zExtractDir & $sName, 0x00001000 + 2) Local $tStruct = DllStructCreate("ptr", $outStream) Local $Stream = $oIOutStream() $oIOutStream.AddRef() DllStructSetData($tStruct, 1, $Stream) $iIdx += 1 EndIf Return $S_OK EndFunc IOutStream_Write in IOutStream.au3: Func IOutStream_Write($pSelf, $pData, $iSize, $iProcessedSize) If IsObj( $oIStreamOut ) Then Return $oIStreamOut.Write($pData, $iSize, $iProcessedSize) EndFunc Output in SciTE: Number of Items: 10 All items: 0. WinAll, size = 0 bytes, isDir = True 1. WinAll\amd64.cab, size = 418789 bytes, isDir = False 2. WinAll\i386.cab, size = 358996 bytes, isDir = False 3. WinAll\beholder.bin, size = 281569 bytes, isDir = False 4. WinAll\Install.exe, size = 75072 bytes, isDir = False 5. WinAll\install.x64, size = 84480 bytes, isDir = False 6. WinAll\beholder.cat, size = 22413 bytes, isDir = False 7. WinAll\beholder.inf, size = 20452 bytes, isDir = False 8. Beholder.nfo, size = 738 bytes, isDir = False 9. www.SamLab.ws.url, size = 94 bytes, isDir = False IArchiveExtractCallback_GetStream $index = 7 IArchiveExtractCallback_GetStream $sName = WinAll\beholder.inf oIInArchive.Extract $hresult = 0x00000000 IArchiveExtractCallback_GetStream $index = 0 IArchiveExtractCallback_GetStream $sName = WinAll IArchiveExtractCallback_GetStream $index = 7 IArchiveExtractCallback_GetStream $sName = WinAll\beholder.inf IArchiveExtractCallback_GetStream $index = 9 IArchiveExtractCallback_GetStream $sName = www.SamLab.ws.url oIInArchive.Extract $hresult = 0x00000000 All code is included in the zip. Run Example.au3. You need 7z.dll and 7z_Extract_Example.7z from the zip in the post above (end of line 2). 7-ZipCode.7z1 point
-
ronaldo97, The @DeskTopWidth & @DeskTopHeight macros will give you the screen size - you then need to calculate what size and position you require for the GUI. Create the GUI at full size and use GUICtrlSetResizing on the controls (or use Opt("GUIResizeMode")) so that the controls will resize as well. Then resize and move the GUI like this: ; Set GUI to required position and size GUISetState(@SW_HIDE) WinMove($hGUI, "", $iMain_X, $iMain_Y, $iMain_W, $iMain_H) GUISetState(@SW_SHOW) Please ask if you have any questions. M231 point
-
I just checked the documentation... and indeed, you are correct! Not is the first operation in the order... I have updated my snippet. Thanks for the clarification1 point
-
Very interesting post ! Here is, I think, a start point : Func _WinAPI_ORCloseKey($hKey) Local $aRet = DllCall("Offreg.dll", "dword", "ORCloseKey", "handle", $hKey) If @error Then Return SetError(@error, @extended, '') If $aRet[0] Then Return SetError(10, $aRet[0], '') Return 1 EndFunc Func _WinAPI_ORCloseHive($hHive) Local $aRet = DllCall("Offreg.dll", "dword", "ORCloseHive", "handle", $hHive) If @error Then Return SetError(@error, @extended, '') If $aRet[0] Then Return SetError(10, $aRet[0], '') Return 1 EndFunc Func _WinAPI_OREnumKey($hKey, $iIndex) Local $aRet = DllCall("Offreg.dll", "dword", "OREnumKey", "handle", $hKey, "dword", $iIndex, "wstr", "", "dword*", 256, "ptr", 0, "ptr", 0, 'ptr', 0) If @error Then Return SetError(@error, @extended, '') If $aRet[0] Then Return SetError(10, $aRet[0], '') Return $aRet[3] EndFunc Func _WinAPI_OREnumValue($hKey, $iIndex) Local $aRet = DllCall("Offreg.dll", "dword", "OREnumValue", "handle", $hKey, "dword", $iIndex, "wstr", "", "dword*", 16384, "ptr", 0, "ptr", 0, 'ptr', 0) If @error Then Return SetError(@error, @extended, '') If $aRet[0] Then Return SetError(10, $aRet[0], '') Return $aRet[3] EndFunc Func _WinAPI_OROpenHive($sHivePath) Local $aRet = DllCall("Offreg.dll", "dword", "OROpenHive", "wstr", $sHivePath, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aRet[0] Then Return SetError(10, $aRet[0], 0) Return $aRet[2] EndFunc Func _WinAPI_OROpenKey($hHive, $sSubKey) Local $aRet = DllCall("Offreg.dll", "dword", "OROpenKey", "handle", $hHive, "wstr", $sSubKey, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aRet[0] Then Return SetError(10, $aRet[0], 0) Return $aRet[3] EndFunc I did not manage to build the _WinAPI_ORGetValue function. I'm not quite comfortable with that yet.1 point
-
This is a little experiment that makes use of a "Browser Control" embedded in a GUI in order to be able to use AutoIt, HTML, JavaScript and CSS all together. This little toy will only work on systems with IE11. The purpose is to drag all the names of the scientists & drop on the right ones. (among scientists it has also infiltrated an intruder). I hope you find it entertaining. I've posted it here in the hope to have some suggestions on how to improve it all (I mean the interaction between Autoit Javascript html and css). Thanks ; this works on systems with IE11 ; ------------------------------- #include <GUIConstantsEx.au3> #include <array.au3> Global $oIE, $oDocument, $ohJS, $sDroping Global $iCorrect = 0, $iGoal = 11 Example() Exit Func Example() Local $aScientists[12][2] = _ [["Schrodinger", "Schrodinger"],["Planck", "Planck"],["Pauli", "Pauli"],["Einstein", "Einstein"], _ ["Chimp", "Chimp"],["Dirac", "Dirac"],["Heisenberg", "Heisenberg"],["Born", "Born"], _ ["De Broglie", "De_Broglie"],["Bohr", "Bohr"],["Sommerfeld", "Sommerfeld"],["", "empty"]] Local $oIE = ObjCreate("Shell.Explorer.2") ; Create a BrowserControl Local $hGUI = GUICreate("", 660, 600, 30, 30) GUICtrlCreateObj($oIE, 0, 0, 660, 600) ; Place BrowserControl on the GUI GUISetState() ;Show GUI $oIE.navigate('about:blank') ; file:///' & @ScriptDir & '\WhoIsWho.html') While Not String($oIE.readyState) = 'complete' ; wait for about:blank Sleep(100) WEnd ; this waits till the document is ready to be used (portion of code from IE.au3) While Not (String($oIE.readyState) = "complete" Or $oIE.readyState = 4) Sleep(100) WEnd While Not (String($oIE.document.readyState) = "complete" Or $oIE.document.readyState = 4) Sleep(100) WEnd $oIE.document.Write(_GetHTML()) ; inject lising directly to the HTML document: $oIE.document.close() ; close the write stream $oIE.document.execCommand("Refresh") While Not String($oIE.readyState) = 'complete' ; wait for readyState after a refresh Sleep(100) WEnd ; https://msdn.microsoft.com/en-us/library/52f50e9t(v=vs.94).aspx ; $ohJS is a reference to the javascript Global Obj ; ------------------------------------------------- $ohJS = $oIE.document.parentwindow.JSglobal $oDocument = $oIE.document Local $oTable1 = $ohJS.table1 Local $oTable2 = $ohJS.table2 _Randomize($aScientists, $oTable1) ; --- Setup events ------------ ; https://msdn.microsoft.com/en-us/library/hh801967(v=vs.85).aspx Local $aoEventObject[2] $aoEventObject[0] = ObjEvent($oTable1, "IEEvent_", "HTMLTableEvents2") $aoEventObject[1] = ObjEvent($oTable2, "IEEvent_", "HTMLTableEvents2") ; ----------------------------- ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch If $iCorrect = $iGoal Then _Goal() _Randomize($aScientists, $oTable1) $iCorrect = 0 EndIf WEnd ; the end For $i = 0 To UBound($aoEventObject) - 1 $aoEventObject[$i] .stop Next $aoEventObject = 0 ; Kill the Event Object $oIE = 0 ; Remove IE from memory (not really necessary). GUIDelete($hGUI) ; Remove GUI EndFunc ;==>Example ; --- event management zone --- ; following functions are fired by events occurred in the browser control Volatile Func IEEvent_onDragstart($oEvent) ; we save the ID of the dragged obj into the $sDroping variable ; for a later use in the drop function $sDroping = $oEvent.srcElement.ID EndFunc ;==>IEEvent_onDragstart Volatile Func IEEvent_onDragOver($oEvent) $ohJS.event.preventDefault() EndFunc ;==>IEEvent_onDragOver Volatile Func IEEvent_onDrop($oEvent) $ohJS.event.preventDefault() If $sDroping <> "" Then If $oDocument.getElementById($sDroping).innerText <> $oEvent.srcElement.innerText Then If $oEvent.srcElement.ClassName = $oDocument.getElementById($sDroping).ClassName Then $oEvent.srcElement.innerText = $oDocument.getElementById($sDroping).innerText $oDocument.getElementById($sDroping).innerText = "" $oDocument.getElementById($sDroping).draggable = False $oDocument.getElementById($sDroping).setAttribute("style") = "background-color: #80ff80;" $iCorrect += 1 Else For $i = 1 To 3 $oDocument.getElementById($sDroping).setAttribute("style") = "background-color: #ff0000;" Sleep(125) $oDocument.getElementById($sDroping).setAttribute("style") = "background-color: #ffffff;" Sleep(125) Next EndIf EndIf $sDroping = "" EndIf EndFunc ;==>IEEvent_onDrop Func _Randomize(ByRef $aScientists, ByRef $oTable) Local $iRows = ($oTable.rows.length) - 1 Local $iCols = ($oTable.rows.item(0).cells.length) - 1 Local $index _ArrayShuffle($aScientists) For $y = 0 To $iRows For $x = 0 To $iCols $index = ($y * ($iCols + 1)) + $x $oTable.rows.item($y).cells.item($x).innerText = $aScientists[$index][0] ; text $oTable.rows.item($y).cells.item($x).className = $aScientists[$index][1] ; class $oTable.rows.item($y).cells.item($x).draggable = $aScientists[$index][0] <> "" Next Next EndFunc ;==>_Randomize Func _Goal() Local $oTable1 = $ohJS.table1 ; names Local $oTable2 = $ohJS.table2 ; photos Local $iRows = ($oTable1.rows.length) Sleep(250) Local $iCols = 6 ; ($oTable1.rows.item(0).cells.length) Local $aIndex[$iRows * $iCols], $sTemp For $i = 0 To UBound($aIndex) - 1 $aIndex[$i] = $i ; + 1 Next _ArrayShuffle($aIndex) For $i = 0 To UBound($aIndex) - 1 $oTable2.rows.item(Int($aIndex[$i] / $iCols)).cells.item(Mod($aIndex[$i], $iCols)).innerText = "" $oTemp0 = $oTable2.rows $oTemp1 = $oTemp0.item(Int($aIndex[$i] / $iCols)).cells $oTemp2 = $oTemp1.item(Mod($aIndex[$i], $iCols)).getAttribute("style") $oTable2.rows.item(Int($aIndex[$i] / $iCols)).cells.item(Mod($aIndex[$i], $iCols)).setAttribute("style") = "background-color: " & _rndColor() Sleep(100); MsgBox(0,"Debug",$sTemp) $oTable2.rows.item(Int($aIndex[$i] / $iCols)).cells.item(Mod($aIndex[$i], $iCols)).setAttribute("style") = $oTemp2 Next For $x = 1 To 2 For $i = 0 To UBound($aIndex) - 1 $oTable1.rows.item(Int($aIndex[$i] / $iCols)).cells.item(Mod($aIndex[$i], $iCols)).setAttribute("style") = "background-color: " & _rndColor() Sleep(100) $oTable1.rows.item(Int($aIndex[$i] / $iCols)).cells.item(Mod($aIndex[$i], $iCols)).setAttribute("style") = "background-color: #ffffff;" Next Next EndFunc ;==>_Goal Func _rndColor() Return String("#" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & ";") EndFunc ;==>_rndColor Func _GetHTML() Local $sHTML = _ "<!DOCTYPE HTML>" & @CRLF & _ "<html>" & @CRLF & _ "<head>" & @CRLF & _ "<meta http-equiv=""X-UA-Compatible"" content=""IE=edge"" />" & @CRLF & _ " <script type=""text/javascript"">" & @CRLF & _ " var JSglobal = (1,eval)(""this"");" & @CRLF & _ " </script>" & @CRLF & _ "</head>" & @CRLF & _ "<body>" & @CRLF & _ "<h2>Who is who?</h2>" & @CRLF & _ "<p>Drag&Drop names on the right scientist</p>" & @CRLF & _ "<img src=""https://i.imgur.com/STWql7w.jpg""" & @CRLF & _ "height=""394"" width=""640""" & @CRLF & _ "style=""position: absolute; left: 10px; top: 100px;"">" & @CRLF & _ "" & @CRLF & _ "<style>" & @CRLF & _ ".target td {width: 100px; height: 160px; text-align: center; color: white; font-weight: bold; vertical-align: bottom; border: 0px solid grey;}" & @CRLF & _ ".source td {width: 100px; height: 30px; text-align: center; border: 1px solid red;}" & @CRLF & _ "</style>" & @CRLF & _ "" & @CRLF & _ "<table class=""target"" style=""position: absolute; left: 25px; top: 100px;"" id=""table2"">" & @CRLF & _ " <tr><td class=""Schrodinger""></td><td class=""Planck""></td><td class=""Pauli""></td><td class=""Einstein""></td><td class=""Chimp""></td><td class=""Dirac""></td></tr>" & @CRLF & _ " <tr><td class=""Heisenberg""></td><td class=""Born""></td><td class=""De_Broglie""></td><td class=""Bohr""></td><td class=""Sommerfeld""></td><td class=""empty""></td></tr>" & @CRLF & _ "</table>" & @CRLF & _ "" & @CRLF & _ "<table class=""source"" style=""position: absolute; left: 10px; top: 504px;"" id=""table1"">" & @CRLF & _ " <tr><td ID=""td1""></td><td ID=""td2""></td><td ID=""td3""></td><td ID=""td4"" ></td><td ID=""td5"" ></td><td ID=""td6"" ></td></tr>" & @CRLF & _ " <tr><td ID=""td7""></td><td ID=""td8""></td><td ID=""td9""></td><td ID=""td10""></td><td ID=""td11""></td><td ID=""td12""></td></tr>" & @CRLF & _ "</table>" & @CRLF & _ "</body>" & @CRLF & _ "</html>" Return $sHTML EndFunc ;==>_GetHTML1 point
-
No problem Watch out though - rege̢x҉ has a tend̕e͡nçy to drive yo u͝ ą̀͟bsò̡͘lu̶ţ̡ ely s̀̕͢t̴̀̕a̷͠r͢͞k̕͜͝ r̨͘a̵v͠͏i̵ǹ̵g̸̶ bonkers a̵̴ǹ͞͏d̸͞ is al̡҉͝ş̛̕o̴̡ ̷̧͘ex͏̶҉t͟͞ré̢mé̢l̀͏͢y̧҉͟ ̵a̶̴̴d̸̛ḑ͞i͏ç̡̢t̵͠ìv͜e̸̸͡ . It pushes i͜ts̕el̀f ̨on you̕ like a hellish s͢͢͞͠͠c̵̛̕̕o͡͠u̶̢̕r͏̷̢͘ģ̴̴͠͠e͜͟ ̴̧͞͝͞o̸̕͝͏f̡͏̸͡ ͟e̷̵̡̡͜v̸͟͜͞i͏̨͟l̨͢ an d̴̕҉ ̕ma҉̕͡ke͞s͢ ̡i͠t̶̨se͟l̡f͝ ̀s͞͝͡ęe҉̀̕m͞ ͞li̵͡k͡e ̛́t̵̢h̸e͜ ̵́̕ only hammer you will ever need to solve any problem! Damn you regex, daaaaamn you alllll to hellllllll W̷̡̡̪̤͕͉͙͎̳͋̎̓͑͐̑ͤ͆̎͊͟͠H̷̴̡̟̠͙͎͚̪͇̭̻̲̻͔͛̋ͧͣ͆̉͑̽́͌̄̓ͪ͘Y̵̴̗̘͚̞̦͈̮͈͚͈̖̍̔̂̇͡͞ͅ ̵̵̡̧͕̞͈̝̫͎̖̩͕̻͓̜̣̝͚͓̠̺͑ͬͮ͌̋ͮͪ̂ͧͫ͊ͤ̽͂͆̃͞R̒ͩ̂ͧ̊͒̿͛̿̽ͪ̿ͤ̒̐͒ͭͩͣ͜҉̸̘͓̭̗͙̯̠̼ͅĒ̢̫̜̘̱̠͇͕̘̦͔͖͎̫̻̦̂̅ͪ̃͛̕G̨̰͍̫̮̠̼͔̭͎̃ͬ̂̎ͦ͂ͦ̋ͯͩ̉̌̆̑̊̃̃͢͡E̥̣̺̜̹̞̲̗͖̮̗͊ͥ͌ͧͮ̂͋͑̈ͧͯ̃̾ͯ͘͞͞X̶̡̿͋͂ͧ̊̎ͨͬ͆̒͑̓̌͗̍̚͞͞͏̙̭͎͉͎̼̭ ̂̃̊͏͇̦̠͇̭͇̬̳̠̗̪̱̣͚̞̳̗́Ẇ̴̵̞̳̻̼̟͚̤̪̊̍̈̊̓ͧ̒̐̈́̇̕ͅH̷̥̹̼͙̮̮̻̯͉̹̞̰̙ͬͦͯ̑ͪͨ̌̽ͯ̍̉̓̈́̆͊̈̃̚͞͠͠Ÿ̢̞̘͖̼̰̠͉̞̻̙̯́͊ͭ͗̔̒͑̃̾͛ͦͅ1 point
-
User Groups and Rights New Members - New members with that joined the forum within the last day. While in this group there are certain restrictions on the number of posts/PMs that can be made. This is to reduce the impact of spammers. After 24 hours members of this group will be promoted the Members group. Members - Members older than one day but with less than 20 posts. Standard access to the forum. Active Members - Members with more than 20 posts have additional rights No advertsSlightly more generous attachment and PM limitsAccess to the Chat forumAbility to upload files to the Downloads section MVPs - Members who are judged by the community to be helpful, who write and share useful code, who help the development of AutoIt. These users have the same rights as normal members but get a team icon, a little more attachment and PM space, and access to the MVP Chat forum section. Moderators - The forum police. This is not a democracy and each of the mods has their own distinct personality. They have the rights to edit posts, delete posts, ban users, delete users, IP ban, etc. Let the poster beware. Developers - A small group of users with access to the AutoIt source code and who have contributed significantly to the internal development of AutoIt. Some of them are also Moderators. Post Count and Rankings Ranks based on increasing post count are as follows: SeekerWayfarerAdventurerProdigyPolymathUniversalistThese titles are auto-generated and have no relation to actual skill level. Once you reach 300 posts you can change the title to whatever you like.1 point