Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/04/2014 in all areas

  1. I wrote this power user tool a long while back and it originally had baked in commands and wasn't very extensible. I rewrote the tool and made use of the power and openeness of AutoIt. Some of you may find the concept and/or UI approach interesting (as well as useful) which is why I'm posting here. In all likely-hood, it could be rewritten entirely in AutoIt but that's not something I plan on doing. Good chance there are similar tools out there as well especially since I've sat on this for so long. In short, the tool provides a snazzy user interface (no two interfaces will look alike) which opens right over whatever your working on so you can quickly launch any number of chained AutoIt scripts. My all-time favorite being; normalize clipboard text. https://winclickpro.codeplex.com/ I haven't shared the tool or concept with anyone outside of publishing it so I'm curious to see what people think.
    1 point
  2. Jos

    Au3Stripper

    Sigh, Look in the damn ZIP file for the proper structure! over and out
    1 point
  3. 1 point
  4. xbennY0, Why not just use _FileListToArrayRec to get all of these files into an array and then loop through it reading their content, adding this content to a single text file, and then deleting them? That sounds the quickest way of doing you want. Although I would delete the files on a second pass - just in case something goes wrong. M23
    1 point
  5. Azevedo, Look at my GUIListViewEx UDF (the link is in my sig) which allows you to drag items within and between ListViews - as well as lot of other interesting things! M23 Edit: Or in MikahS' post above!
    1 point
  6. mike2003, Oh ye of little faith! Why on earth would I tell you something that was not correct? The code is not coloured until you post and the forum software does some Geshi magic depending on its syntax. Go and test in the "Test posting" section if you still do not believe me. M23
    1 point
  7. Yeah i get that, i just meant that you cannot overwrite and append at the same time?
    1 point
  8. Are you sure, do you even know what a struct is? What possible use would they be to you as a struct, and what would you do with the contents of this struct once yo've deleted the folders and put them inside it?
    1 point
  9. You can't have a file and a folder with the same name in the same directory. It's a Windows limitation.
    1 point
  10. msgbox(0, '' , @ComSpec & " /k " & @ProgramFilesDir & "\M93\devcon.exe" & " " & "update" & " " & @ProgramFilesDir & "\M93\Display\Intel(R) HD Graphics 4600\kit64ib.inf" & " " & "PCI\VEN_8086&DEV_0412") and you need to wrap your quotes, you will fail specifying the program files directory as it potentially has a space: msgbox (0, '' , '"' & @ProgramFilesDir & "\M93\devcon.exe" & '"')
    1 point
  11. Personally, I usually execute directly, rather than using @ComSpec. Something like this: ShellExecuteWait(@ProgramFilesDir & "\M93\devcon.exe", "update " & @ProgramFilesDir & "\M93\Display\Intel(R) HD Graphics4600\kit64ib.inf PCI\VEN_8086&DEV_0412")
    1 point
  12. jvanegmond

    WinHTTP functions

    Hey Raizeno, try this: #include "WinHttp.au3" $sAddress = "https://api.pushover.net/1/messages.json" $sApiToken = "av26ac2nAXLyPKg2QMy4zf9YcUjz2G" ; <-yours here $sUserKey = "uMQf396GvMgrsDroaryKEvVyWkgfkw" ; <-yours here $sMessage = "hello world" ; Construct the form Const $sForm = '<form action="' & $sAddress & '" method="post">' & _ '<input name="token" value="' & $sApiToken & '"/>' & _ '<input name="user" value="' & $sUserKey & '"/>' & _ '<input name="message" value="' & $sMessage & '"/>' & _ '</form>' ; Open session $hOpen = _WinHttpOpen() ; To collect connection handle (because the form is inlined) $hConnect = $sForm ; Fill the form $sRead = _WinHttpSimpleFormFill($hConnect, $hOpen) ; Close handles _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Tada mtfk! MsgBox(4096, "Simon says", $sRead)
    1 point
  13. MrBeatnik, When I look inside the function it seems to me that the flag to detect if the disk is write-protected is working in the reverse sense - I will consult with the Devs and get back to you. Could you please test this modified function and see if it works for you - it does for me: #include <WinAPIFiles.au3> Local $aDrive = DriveGetDrive('ALL') If IsArray($aDrive) Then Local $sText For $i = 1 To $aDrive[0] If _WinAPI_IsWritable_Mod($aDrive[$i]) Then $sText = 'Writable' Else $sText = 'Not writable' EndIf If Not @error Then ConsoleWrite(StringUpper($aDrive[$i]) & ' => ' & $sText & @CRLF) EndIf Next EndIf Func _WinAPI_IsWritable_Mod($sDrive) Local $hFile = _WinAPI_CreateFileEx('\\.\' & $sDrive, $OPEN_EXISTING, 0, $FILE_SHARE_READWRITE) If @error Then Return SetError(@error + 20, @extended, False) Local Const $ERROR_WRITE_PROTECT = 19 ; The media is write protected Local $aRet = DllCall('kernel32.dll', 'bool', 'DeviceIoControl', 'handle', $hFile, 'dword', 0x00070024, 'ptr', 0, 'dword', 0, _ 'ptr', 0, 'dword', 0, 'dword*', 0, 'ptr', 0) If __CheckErrorCloseHandle($aRet, $hFile, 1) <> 10 And @extended = $ERROR_WRITE_PROTECT Then Return SetError(@error, @extended, False) Return $aRet[0] EndFunc ;==>_WinAPI_IsWritable_Mod M23
    1 point
  14. Example: #include <GDIPlus.au3> Global $hGUI = GUICreate("", 512, 512) _GDIPlus_Startup() $hTextureArrow = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\arrow.png") $iW = _GDIPlus_ImageGetWidth($hTextureArrow) $iH = _GDIPlus_ImageGetHeight($hTextureArrow) $iW2 = $iW / 2 $iH2 = $iH / 2 $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics(512, 512, $hGraphic) $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) $hBitmap_Background = _GDIPlus_ImageLoadFromFile("c:\Program Files (x86)\AutoIt3\Examples\GUI\logo4.gif") $iW2_Bg = _GDIPlus_ImageGetWidth($hBitmap_Background) / 2 $iH2_Bg = _GDIPlus_ImageGetHeight($hBitmap_Background) / 2 $hBitmap_Arrow = _GDIPlus_BitmapCreateFromGraphics($iW, $iW, $hBackbuffer) $hGCArrow = _GDIPlus_ImageGetGraphicsContext($hBitmap_Arrow) $hMatrixArrow = _GDIPlus_MatrixCreate() GUISetState() While 1 Switch GUIGetMsg() Case -3 _GDIPlus_MatrixDispose($hMatrixArrow) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hGCArrow) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_BitmapDispose($hBitmap_Arrow) _GDIPlus_BitmapDispose($hTextureArrow) _GDIPlus_ImageDispose($hBitmap_Background) _GDIPlus_GraphicsDispose($hBackbuffer) _GDIPlus_Shutdown() Exit EndSwitch Rotate() WEnd Func Rotate() _GDIPlus_GraphicsClear($hBackbuffer, 0xFF6495ED) _GDIPlus_MatrixTranslate($hMatrixArrow, $iW2, $iW2) ; move it back to 0, 0 since (112 / 2) and (37 / 2) are it's middle origin point _GDIPlus_MatrixRotate($hMatrixArrow, 1) ; rotate it around it's middle origin point _GDIPlus_GraphicsSetTransform($hGCArrow, $hMatrixArrow) _GDIPlus_MatrixTranslate($hMatrixArrow, -$iW2, -$iW2) _GDIPlus_GraphicsClear($hGCArrow, 0x00000000) _GDIPlus_GraphicsDrawImageRect($hGCArrow, $hTextureArrow, -$iW2, -$iH2, $iW, $iH) ; place the arrow at the center of it's GC _GDIPlus_GraphicsDrawImage($hBackbuffer, $hBitmap_Background, (256 - $iW2_Bg), (256 - $iH2_Bg)) ; show the GC _GDIPlus_GraphicsDrawImage($hBackbuffer, $hBitmap_Arrow, 256 - $iW2, 256 - $iW2) ; move it's GC by an offset so the image is at the correct XY using it's origin _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, 512, 512) EndFunc Br, UEZ
    1 point
  15. The following script loops through all Stories, processes the footnotes and writes them to the Console. #include <word.au3> $oWord = _Word_Create() $oDoc = _Word_DocOpen($oWord, @ScriptDir & "\test.docx") Global Const $wdFootnotesStory = 2 For $oStory In $oDoc.StoryRanges ; Process all Stories of the document If $oStory.StoryType = $wdFootnotesStory Then ; Only process Footnotes $oStoryRange = $oStory While $oStoryRange.NextStoryRange <> 0 ; Loop through the footnotes ; Process $oStory.NextStoryRange here ConsoleWrite("Footnotes: " & @CRLF & $oStoryRange.Text) $oStoryRange = $oStoryRange.NextStoryRange WEnd EndIf Next
    1 point
  16. Melba23

    Adding Array Values

    gr1fter, Given that the numbers you are looking for are easily extracted with a RegEx, I would do something like this: ; Read the entire file in one go $sText = "2014-10-30_1132 AM,test,H142640E4,Computer ,11.231.42.101,Name,11:31:17:109,11:31:25:389,11:31:37:775,11:31:39:164,22,9" & @CRLF & _ "2014-10-30_1140 AM,test,H142640E4,Computer ,11.231.42.101,Name,11:39:56:516,11:40:03:652,11:40:07:583,11:40:08:971,12,800" & @CRLF & _ "2014-10-30_1140 AM,test,H142640E4,Computer ,11.231.42.101,Name,11:39:56:516,11:40:03:652,11:40:07:583,11:40:08:971,12,12" & @CRLF & _ "2014-10-30_1140 AM,test,H142640E4,Computer ,11.231.42.101,Name,11:39:56:516,11:40:03:652,11:40:07:583,11:40:08:971,12,4552" ; Extract the final number - look for a comma, a string of digits and either an EOL or EOF $aRet = StringRegExp($sText, ",(\d+)(?:\v|$)", 3) ; Add the extracted numbers $iTotal = 0 For $i = 0 To UBound($aRet) - 1 $iTotal += $aRet[$i] Next ; And divide by the count $nAverage = $iTotal / UBound($aRet) ; And the result looks correct to me ConsoleWrite($nAverage & @CRLF) I think that using a RegEx will be faster then splitting each line, particularly if the file is very large, but your approach should also work if you prefer it. M23
    1 point
  17. Or you could use my OutllokEX UDF, attach the image and reference using CID as described in the _OL_ItemCreate example.
    1 point
  18. I agree with JohnOne. Imagine if that facebook extension you used said "hey if you want to use me, the get a developer API from facebook". You would be like "what the??!" I'm just a simple user, what's an API and developer?!
    1 point
  19. Yes! How? this is a good idea?
    1 point
  20. You should used "chained insertion" like this: insert into XYZ values (...), (...), (...), ... The more rows you insert at once the faster the insertion is (that's untrue literally but at least you get a significant speed increase). Your initial script took > 5 minutes on my slow PC but this version take 15 seconds. #include <SQLite.au3> ;~ #include <SQLite.dll.au3> ; download the most recent suitable DLL once and comment this out #include <Date.au3> Local $hQuery, $aRow, $hMemDb _SQLite_Startup() ; @OSArch isn't the macro you would use here ; also not mentionning the DLL full name is easier ;~ If @AutoItX64 Then ;~ _SQLite_Startup() ; "SQLite3-64.dll") ;~ Else ;~ _SQLite_Startup() ; "SQLite3.dll") ;~ EndIf $hMemDb = _SQLite_Open() ; :memory: is by default ; Creates a :memory: database If @error Then ConsoleWrite("Can't create a memory Database!" & @CRLF) Exit EndIf ; these are default for a :memory: DB ;~ _SQLite_Exec($hMemDb, "PRAGMA journal_mode = OFF;") ;~ _SQLite_Exec($hMemDb, "PRAGMA temp_store = MEMORY;") $Query = "Create table FileName_LineNumber (Nr integer, T1 Text, T2 Text);" _SQLite_Exec($hMemDb, $Query) If @error Then ConsoleWrite("Table" & @CRLF) Exit ; meaningless to assign the DB handle to return code EndIf Local $HH, $MM, $SS Local $StartTime = TimerInit() _SQLite_Exec($hMemDb, "BEGIN") ; implicit TRANSACTION;") Local $iLimit = 1000000 Local $iChunk = 200 Local $sSQL = "Insert into FileName_LineNumber values " Local $Insert = $sSQL For $i = 1 To $iLimit $Insert &= "(" & $i & ",'Test1','Test2')" If Mod($i, $iChunk) Then $Insert &= "," Else _SQLite_Exec($hMemDb, $Insert) $Insert = $sSQL EndIf ; essentially useless ;~ If @error Then ;~ ConsoleWrite("Insert" & @CRLF) ;~ Exit $hMemDb ;~ EndIf Next _SQLite_Exec($hMemDb, "COMMIT") ; TRANSACTION;") ;Time Elapsed Local $TimeSpent = TimerDiff($StartTime) _TicksToTime($TimeSpent, $HH, $MM, $SS) ConsoleWrite("Time Elapsed : " & StringFormat("%02i:%02i:%02i", $HH, $MM, $SS) & @CRLF) Note that the same script took no more than 16 seconds when using a disk-based (non SSD) DB. For real-world applications, beware that SQLite SQL command has some size limit that you shouldn't exceed. So don't try to insert 500000 values at a time!
    1 point
×
×
  • Create New...