Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/30/2016 in all areas

  1. Try: RUN('"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 21"') Jos
    1 point
  2. Like this: #include <IE.au3> #include <Array.au3> Local $oIE = _IECreate("https://www.autoitscript.com/forum/topic/181589-ietagnamegetcollection-overcharged/") Local $sHTML = _IEDocReadHTML($oIE) Sleep(15000) ;make sure the website is completely loaded Local $Text_inside_element = StringRegExp($sHTML, '(?i)<meta content="(.*?)" property="og:title">', 3) ;global _ArrayDisplay($Text_inside_element) ;results inside array if isarray($Text_inside_element) then MsgBox(0, "", $Text_inside_element[0]) Exit In this example you are getting the data inside a tag "meta". Read about the StringRegExp and you will understand how to grab that the data you want.
    1 point
  3. Here's the logic behind your script. Create a gui, add some control, go to infinite while loop that stops execution of everything below it and just checks for the close event, get the services on the computer. Try this #include <GuiListView.au3> #include <GUIConstants.au3> Dim $Services Dim $ServicesList #cs While 1 CheckService() Sleep(30000) ; sleep 30 seconds WEnd #ce ;#cs #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Tab1 = GUICtrlCreateTab(0, 48, 609, 385) $TabSheet1 = GUICtrlCreateTabItem("Running Services") $ListView1 = GUICtrlCreateListView("Service Name|Status", 8, 72, 593, 281, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 0, 300) GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 1, 288) $Button1 = GUICtrlCreateButton("Stop Services", 464, 376, 129, 33) $TabSheet2 = GUICtrlCreateTabItem("Stopped Services") GUICtrlSetState(-1, $GUI_SHOW) $ListView2 = GUICtrlCreateListView("Service Name|Status", 8, 72, 593, 281, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) GUICtrlSendMsg($ListView2, $LVM_SETCOLUMNWIDTH, 0, 300) GUICtrlSendMsg($ListView2, $LVM_SETCOLUMNWIDTH, 1, 288) $Button2 = GUICtrlCreateButton("Start Services", 464, 376, 129, 33) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### AdlibRegister(CheckServices, 1000) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;#ce ;$Tab1 = GUICtrlCreateTab(16, 8, 601, 377) ;$TabSheet1 = GUICtrlCreateTabItem("Running Services") ;$ListView1 = GUICtrlCreateListView("Service Name", 24, 40, 582, 334) ;_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) ;$ServiceName = "wuauserv" Func CheckServices() Local $Services = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2") Local $ServicesList = $Services.ExecQuery("SELECT * FROM Win32_Service") If IsObj($ServicesList) Then For $Services In $ServicesList ;If $Services.Name = $ServiceName Then ; if $Services.State = "Running" Then MsgBox(8192, "Hello", $Services.Name & $Services.State, 0, $Form1) ;GUICtrlCreateListViewItem( $Services.Name & "|" & $Services.State , $ListView1) ;Run (@ComSpec & " /c " & 'net stop wuauserv') ; EndIf ;EndIf Next EndIf EndFunc ;==>CheckServices
    1 point
  4. If you have tested "Examples\2) Entire columns\8 listviews\1) Colors and fonts, GUI.au3", where all listviews are created directly in the GUI, you have seen that ListView 8 performs much better than ListView 1. This is evident in particular on a not too fast PC, if you drag the scrollbar up and down with the mouse. What's the reason for the difference in performance? According to the message flow in this picture (copied from the Subclassing section) the performance should be the same in all listviews. I've studied this example more carefully by adding some ConsoleWrite statements to the callback function. It turns out that if you work intensively in the same listview for example by dragging the scrollbar, the message flow looks as shown here: The messages from ListView 1 are sent to callback function 1, 2 and 3. But the messages from ListView 3 are sent only to callback function 3. It's clear that ListView 3 performs better than ListView 1. If you work intensively in a listview the vast majority of messages follows the last diagram and only a few messages (before you start and after you have finished) follows the first diagram. The listview that performs best is the listview that's subclassed as the last one. You can verify this by adding the following lines ; Stop subclassing ListView1 ListViewColorsFonts_Exit( $idListView1 ) ; Start subclassing ListView1 ListViewColorsFonts_Init( $idListView1, 8 ) ; $fColorsFonts = 8, ( $iAddRows not used, $bNative not used ) ListViewColorsFonts_SetColumnColorsFonts( $idListView1, 0, "", 0, 0xCCCCFF ) ; Column 0: Back color = Blue ListViewColorsFonts_SetColumnColorsFonts( $idListView1, 2, "", 0, 0xFFCCCC ) ; Column 2: Back color = Red immediately after these lines (after line 240) ; Initialize listview to support column colors/fonts ListViewColorsFonts_Init( $idListView8, 8 ) ; $fColorsFonts = 8, ( $iAddRows not used, $bNative not used ) ListViewColorsFonts_SetColumnColorsFonts( $idListView8, 1, "", $iFontStyleItalic ) ; Column 1: Style = Italic ListViewColorsFonts_SetColumnColorsFonts( $idListView8, 2, "", $iFontStyleUnderline ) ; Column 2: Style = Underline in the example. Now ListView 1 is subclassed as the last one, and it'll perform best. The above applies if all listviews are created directly in main GUI.
    1 point
  5. Hi. You can do something like this (its not the best way, but do the trick). need to be cleaned and free resource.... #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $hDC, $hPen, $o_Orig #Region ### START Koda GUI section ### Form= Global $hGUI = GUICreate("Form1", 603, 348, 192, 124) Global $iLeft = 20, $iTop = 32 Global $Edit1 = GUICtrlCreateEdit("", $iLeft, $iTop, 561, 289) $hDC = _WinAPI_GetWindowDC(GUICtrlGetHandle($Edit1)) ; DC of entire screen (desktop) $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0xFF) $o_Orig = _WinAPI_SelectObject($hDC, $hPen) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $nMsg = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Draw() WEnd Func Draw() Local $aSize = 0 _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) ; force redraw of Gui (Rect=0 Region=0) $aSize = ControlGetPos($hGUI, "", $Edit1) If Not IsArray($aSize) Then Return $aSize[0] = $aSize[0] - $iLeft $aSize[1] = $aSize[1] - $iTop _WinAPI_DrawLine($hDC, $aSize[0], $aSize[1] + 1, $aSize[2], $aSize[1] + 1) _WinAPI_DrawLine($hDC, $aSize[0], $aSize[1] + 1 + 20, $aSize[2] + 1, $aSize[1] + 20) _WinAPI_DrawLine($hDC, $aSize[0], $aSize[1] + 1 + 40, $aSize[2] + 1, $aSize[1] + 40) _WinAPI_DrawLine($hDC, $aSize[0] + 1, $aSize[1], $aSize[0] + 1, $aSize[3]) _WinAPI_DrawLine($hDC, $aSize[2] - 1, $aSize[1], $aSize[2] - 1, $aSize[2]) _WinAPI_DrawLine($hDC, $aSize[0], $aSize[3] - 1, $aSize[2], $aSize[3] - 1) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) ; then force no-redraw of Gui EndFunc ;==>Draw Saludos
    1 point
  6. scintilla4evr

    Advanced Math UDF

    Version 1.3: Added polygonal and n-simplex numbers Added Fibonacci, Lucas and Lucas-Lehmer sequences Added IsPrime3(), faster alternative to both IsPrime1() and IsPrime2() Added IsPrimeAKS() Added IsMersennePrime() Added Lychrel() Added Integral() Added Pascal's triangle Renamed IsPrime() to IsPrime1() Added IdentityMatrix() and TransposeMatrix() Added Solve() Added new IsPrime() Renamed Differential() to Differential2() Added new Differential() And RFTC, I will follow your advice and try to reimplement these functions in AutoIt and get rid of the DLLs. Thanks for the advice! Advanced Math UDF
    1 point
  7. Whether this solves your problems ?
    1 point
  8. Here some photos: Guess who is who!
    1 point
  9. I belive this two links will help you achive your goal. https://www.autoitscript.com/forum/topic/162076-search-an-array-for-duplicates/ https://www.autoitscript.com/forum/topic/165182-counting-and-sorting-duplicate-lines/
    1 point
  10. water

    Active Directory Scripts

    Untested! Please make sure to test on a test system only!! #include <AD.au3> Global $sOU = "" ; OU to process Global $aObjects, $aGroups ; Open Connection to the Active Directory _AD_Open() If @error Then Exit MsgBox(16, "AD", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) ; Get a list of users in the specified OU (subtree) $aObjects = _AD_GetObjectsInOU($sOU, "(&(objectcategory=person)(objectclass=user))", 2, "sAMAccountName,memberof") If @error > 0 Then Exit MsgBox(16, "AD", "Function _AD_GetObjectsInOU encountered a problem. @error = " & @error & ", @extended = " & @extended) ; Process all users For $i = 1 To $aObjects[0][0] $aGroups = StringSplit($aObjects[$i][1], "|") For $j = 1 To $aGroups[0] ; Remove User from group _AD_RemoveUserFromGroup($aGroups[$j], $aObjects[$i][0]) If @error > 0 Then Exit MsgBox(16, "AD", "Function _AD_RemoveUserFromGroup encountered a problem. @error = " & @error & ", @extended = " & @extended) Next ; Add User to new groups (repeat the statement for each group to be added) _AD_AddUserToGroup(">>Set groupname here<<", $aObjects[$i][0]) If @error > 0 Then Exit MsgBox(16, "AD", "Function _AD_AddUserToGroup encountered a problem. @error = " & @error & ", @extended = " & @extended) Next _AD_Close()
    1 point
  11. Good to know that can also trigger this error. Thanks for "talking to us" and sharing the information. Jos
    1 point
  12. Oops - who needs a dog or a cardboard cut-out to talk to when we have this forum? Turns out that the icon file was corrupt and that was what was triggering the 'unable to add resources'. Thanks for listening :-)
    1 point
  13. ;EXAMPLES OF USING @COMSPEC Reminder from Blindwig: "FYI - You only need to call comspec to run internal comands (DIR, COPY, MD, RD, etc) You don't need it for external commands (ATTRIB, CACLS, XCOPY, NET, etc)" ;~USE SIMPLE DOS COMMAND WITH PARAMETERS Run(@ComSpec & ' /k ' & 'dir /os') ;~USE SIMPLE COMMAND WITH FILENAME Run(@ComSpec & ' /k ' & 'attrib "c:\autoexec.bat"') ;~USE ATTRIB Run(@comspec & ' /k ' & 'attrib' & ' +R "run notepad1.au3"');add delay before checking status sleep(1500) run(@comspec & ' /k ' & 'attrib "run notepad1.au3"');delay this line to be sure attrib is set first ;~USE CACLS.EXE Run(@ComSpec & ' /k ' & 'cacls.exe "c:\my music\halloween.mp3"') run(@comspec & ' /k ' & 'cacls.exe "run notepad1.au3" /t /e /p jeff-dell\jeff:f') run(@comspec & ' /k ' & 'cacls.exe "run notepad1.au3" /t /e /p everyone:f') sleep(1500) run(@comspec & ' /k ' & 'cacls.exe "run notepad1.au3"') ;~GET CMD.EXE HELP Run(@ComSpec & " /k help | more") ;ADVANCED CONCEPTS FROM AUTOIT FORUM: $x = 1 RunWait(@ComSpec & " /c " & 'start explorer ' & '"' & 'http://www.atari.com/exchange/rct3/item?id=' & $x & '"', "", @SW_HIDE) RunWait(@ComSpec & ' /c ' & 'cd /d ' & $dir[$cliff] & $lang[$bob] & $op[$mike]) RunWait(@ComSpec & " /c " & "net send " & $MessageSentTo & GUIRead($TextMessageInput)) RunWait(@ComSpec & " /c " & "net send * " & GUIRead($TextMessageInput)) RunWait(@ComSpec & " /c ipconfig > " & "c:\ipconfig.txt", "", @SW_HIDE) Run(@ComSpec & " /c Start " & $SelectedURL, "", @SW_HIDE) RunWait(@ComSpec & ' /c defrag ' & $aD[$c] & ' /f') ; WinXP only RunWait(@ComSpec & ' /c defrag ' & $aD[$c] & ' -a -v >> "' & $sLog & '"') ;WinXP only RunWait(@ComSpec & " /k " & "cd /d " & $db & "\" & $lang & " && wget " & $dl & "/" & $lang & "/" & $sql, "") Run(@ComSpec & ' /c copy "c:\program files\diablo II\d2data.mpq" c:\temp\d2data.mpq') RunWait(@ComSpec & " /c start " & $file, @ScriptDir, @SW_HIDE) RunWait(@comspec & " /c net send "& $PC &" "& $Text,"",@sw_hide) Run(@ComSpec & " /c start clip.txt", @ScriptDir,@sw_hide) RunWait(@ComSpec & ' /C explorer.exe [url=http://www.users.on.net/johnson/resourcehacker/']http://www.users.on.net/johnson/resourcehacker/'[/url], '', @SW_HIDE) Run(@comspec & " /c au3record.exe /o>test.au3","",@SW_HIDE) RunWait(@ComSpec & ' /c "' & @TempDir & '\~execute.bat"', '', @SW_HIDE) Runwait(@comspec & " /c " & '"' & @ScriptDir & '\devcon.exe" enable =net *pci*',"",@SW_HIDE) RunWait(@ComSpec & " /c " & $row & ".exe -m LZX:21 -r -p -P " & $c & "\" & " n " & $c & ".cab" & " " & $c & "\*.*", $res) RunWait(@ComSpec & ' /c c:\psinfo.exe -c "\\' & $host & '" > c:\psinfo.txt', 'c:\', @SW_HIDE) RunWait(@ComSpec & ' /c c:\psinfo.exe -c "\\' & $host & '" > c:\psinfo.txt', 'c:\', @SW_HIDE) RunWait(@ComSpec & " /c " & 'ftp -s:ftp.ftp 192.168.1.200', "", @SW_HIDE) RunWait(@ComSpec & ' /c debug < autoit3.dbg', @TempDir, @SW_HIDE) RunWait(@ComSpec & " /c " & 'netstat -n>c:\ip.txt' , "", @SW_HIDE) RunWait(@Comspec & " /c " & $sCmd & ">" & $sFileList,"",@SW_HIDE) Run(@ComSpec & ' /c start ' & $TAG & $F1, '', @SW_HIDE) RunWait(@Comspec & " /c """ & "nslookup "" " & $IP & " > hostname.txt") RunWait(@comspec & " /c dir *.EXE /s/b>" & $sExeListName,"",@SW_HIDE) RunWait(@comspec & " /c dir *.EXE /s/b|cb.exe","",@SW_HIDE);Uses(cb.exe) to route output from a commandline app straight to the clipboard .. which can then be interrogated from within AU3 (thereby avoiding the need to bounce the info through a file) RunWait(@ComSpec & " /c " & 'del /q /s "' & $dir & '"', "", @SW_HIDE) RunWait(@COMSPEC & $Mount & $parm2, $AlcoholDir, @SW_HIDE) Run(@ComSpec & " /c echo " & $PASS & "|idea.com " & $MODE & " " & _FileGetShortName($FILENAME), "", @SW_HIDE) $rc = RunWait(@ComSpec & ' /c Wscript.exe "' & @TempDir & '\NotesMsg.vbs" //T:30 > sent.log 2>&1', @TempDir, @SW_HIDE) $E = RunWait(@ComSpec & ' /c ""' & @TempDir & '\~blattmp.exe" "' & $TEXT & _ '" -to ' & $DEST & ' -binary -server ' & $SMTPSERVER & ' -log ' & @TempDir & _ '\~maillog.txt -timestamp -f ' & $SENDER & $SUBJECT & '-u ' & $AUTHLOGIN & _ ' -pw ' & $AUTHPASS & '"', @TempDir, @SW_HIDE) $cppid = Run(@ComSpec & ' /c cp "' & $source & '" "' & $dest & '"', @ScriptDir,@SW_HIDE); uses cp.exe from UnixTools $kk32 = runwait(@comspec & " /c dir /a /s /b %systemdrive%\kk32.dll",@SystemDir, @SW_HIDE) $surf = runwait(@comspec & " /c dir /a /s /b %systemdrive%\surf.dat",@SystemDir, @SW_HIDE) $ERRORCODE = RunWait(@ComSpec & " /c ping -n 1 -l 5 " & $IP & $NEXTIP, "", @SW_HIDE) $ERRORCODE = RunWait(@ComSpec & " /c ping -n 1 -l 5 " & $IP & $NEXTIP, "", @SW_HIDE) $val = RunWait(@ComSpec & ' /c xcopy "'& $source & "\" & $find[$i] & '" "' & $dest & '" /i /e /h /Y /D /Z',@TempDir) MsgBox(0, "testing",@ComSpec & " /c xcopy "& $source & "\" & $find[$i] & " " & $dest & " /i /e /h /Y /D")
    1 point
  14. Use the beta au3check in stead of the production version. Jos
    1 point
  15. You are right Chimp. I edited my code : replace (? by (?=) in the 2nd regex (it was an oversight ) Thanks kylomas. An similar code, but with a suppression of non duplicates lines at the beginning : #Include <Array.au3> Local $iCount Local $sData = FileRead("data.txt") ; Eliminate non Duplicates Local $sDuplicates = StringRegExpReplace($sData, "(?s)(?:\A|\R)(\N+)(?=\R|\Z)(?!.*\R\1)", "") ; Duplicates in an Array (uniq rows) Local $aDuplicates = StringRegExp($sDuplicates, "(?s)(?:\A|\R)(\N+)(?=\R|\Z)(?!.*\1)", 3) Local $aResult[ UBound($aDuplicates)][2] For $i = 0 To UBound($aDuplicates) - 1 $aResult[$i][0] = $aDuplicates[$i] $aResult[$i][1] = UBound( StringRegExp($sData, "(?:\A|\R)\Q" & $aDuplicates[$i] & "\E(?=\R|\Z)", 3) ) Next _ArraySort($aResult, 1, 0, 0, 1) _ArrayDisplay($aResult)
    1 point
  16. Andreik

    Games made in Autoit.

    One of my games: >Return To Castle.
    1 point
  17. Maybe the func used in this script can be helpful#include <GUIConstantsEx.au3> ;#include <Array.au3> #include <ListviewConstants.au3> SplashTextOn ("", "Loading...", 180, 60, -1, -1, 49) Global $var = DriveGetDrive("FIXED") $myinfos = _GetDriveInfos() ;_arraydisplay($myinfos) $W = 610 $Ypos = 45+(14*$var[0]) $Main = GuiCreate("Disques", $W+260, $Ypos) $listview = GUICtrlCreateListView("Volume|Nom|Taille (Go)|Disponible (Go)|Occupé (Go)|" & _ "Plein à|Libre (Go)|Disque physique|ID", 10, 5, $W+240, $Ypos-15) For $i = 0 to $var[0]-1 $percentocc = Round(($myinfos[$i][2]-$myinfos[$i][3])*100/$myinfos[$i][2], 1) GUICtrlCreateListViewItem(StringUpper($myinfos[$i][0]) &"|"& $myinfos[$i][6] &"|"& _ $myinfos[$i][4] &"|"& $myinfos[$i][2] &"|"& $myinfos[$i][2]-$myinfos[$i][3] &"|"& _ $percentocc &" %" &"|"& $myinfos[$i][3] &"|"& $myinfos[$i][1] &"|"& $myinfos[$i][5], $listview) Next GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 0, 60) GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 1, 110) GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 2, 70) GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 3, 90) GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 4, 80) GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 5, 70) GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 6, 70) GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 7, 170) GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 8, 120) GUISetState() SplashOff() While GUIGetMsg()<>$GUI_EVENT_CLOSE Sleep(10) WEnd ;====================================== Func _GetDriveInfos() Dim $specifs[$var[0]][7] For $i = 1 to $var[0] Dim $Services = ObjGet('winmgmts:\\.\root\cimv2') Dim $DiskDrives = $Services.ExecQuery("Select Caption, DeviceID From Win32_DiskDrive") For $DiskDrive In $DiskDrives Dim $DiskPartitions = $Services.ExecQuery("Associators of {Win32_DiskDrive.DeviceID='" & _ $DiskDrive.DeviceID & "'} Where AssocClass = Win32_DiskDriveToDiskPartition") For $DiskPartition In $DiskPartitions Dim $LogicalDisks = $Services.ExecQuery ("Associators of {Win32_DiskPartition.DeviceID='" & _ $DiskPartition.DeviceID & "'} Where AssocClass = Win32_LogicalDiskToPartition") For $LogicalDisk In $LogicalDisks If $LogicalDisk.DeviceID = $var[$i] Then $specifs[$i-1][0] = $var[$i] $specifs[$i-1][1] = $DiskDrive.Caption $specifs[$i-1][2] = Round(DriveSpaceTotal($var[$i])/1000 ) $specifs[$i-1][3] = Round(DriveSpaceFree($var[$i])/1000 ) $specifs[$i-1][4] = Round($LogicalDisk.Size/1000000000) $specifs[$i-1][5] = $DiskPartition.DeviceID $specifs[$i-1][6] = $LogicalDisk.VolumeName EndIf Next Next Next Next Return $specifs EndFuncand the UDF scriptomatic.au3 to get more infos
    1 point
  18. Use "" for both the title and text parameters to get the current active window, or you can specify: "[ACTIVE]"
    1 point
  19. WinGetHandle("")
    1 point
×
×
  • Create New...