Leaderboard
Popular Content
Showing content with the highest reputation on 11/15/2016 in all areas
-
Uninstall Java 64 bit
mLipok reacted to JLogan3o13 for a topic
To uninstall, use WMI. This has been discussed numerous times on the forum: $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") $aProducts = $oWMI.ExecQuery("Select * from Win32_Product Where Name LIKE '%Java%'") For $app in $aProducts $app.Uninstall() Next You could also search through the registry's Uninstall key, and uninstall that way.1 point -
isset?
noissetfunction reacted to blizzedout for a topic
is there any way to check if the varuable is set without the var being declared and not getting an error?1 point -
Sorry, I forgot to sort the $aSplit array. I edited my code, try now.1 point
-
#include <WinAPIFiles.au3> #include <Array.au3> Local $aDriveInfo, $iLastDevNumber = -1 Local $aFixed = DriveGetDrive('FIXED'), $aRemovable = DriveGetDrive('REMOVABLE') Local $aDrives[ (IsArray($aFixed) ? $aFixed[0] : 0) + (IsArray($aRemovable) ? $aRemovable[0] : 0) ][3] Local $iDrive = 0 For $i = 1 To UBound($aFixed) - 1 $aDrives[$iDrive][0] = $aFixed[$i] $aDriveInfo = _WinAPI_GetDriveNumber($aFixed[$i]) If Not @error Then $aDrives[$iDrive][1] = $aDriveInfo[1] $aDrives[$iDrive][2] = $aDriveInfo[2] EndIf $iDrive += 1 Next For $i = 1 To UBound($aRemovable) - 1 $aDrives[$iDrive][0] = $aRemovable[$i] $aDriveInfo = _WinAPI_GetDriveNumber($aRemovable[$i]) If Not @error Then $aDrives[$iDrive][1] = $aDriveInfo[1] $aDrives[$iDrive][2] = $aDriveInfo[2] EndIf $iDrive += 1 Next _ArraySort($aDrives, 0, 0, 0, 1) Local $aDisks[ UBound($aDrives) ] [2] Local $sDrivesInfo = "Drive list :" & @CRLF Local $sOutput = "" For $i = 0 To UBound($aDrives) - 1 If IsNumber($aDrives[$i][1]) Then If $aDrives[$i][1] <> $iLastDevNumber Then $iLastDevNumber = $aDrives[$i][1] $aDisks[ $iLastDevNumber ][0] = "Disk " & $aDrives[$i][1] & " - " & _GetDiskNameByNumber($aDrives[$i][1]) & " - " EndIf $aDisks[ $iLastDevNumber ][1] &= $aDrives[$i][0] & ";" EndIf Next Redim $aDisks[$iLastDevNumber + 1][2] For $i = 0 To UBound($aDisks) - 1 $sOutput &= $aDisks[$i][0] & " [" $aSplit = StringRegExp($aDisks[$i][1], "[^;]+", 3) _ArraySort($aSplit) For $j = 0 To UBound($aSplit) - 1 $sOutput &= $aSplit[$j] & "\, " Next $sOutput &= "]" & @CRLF Next $sOutput = StringReplace($sOutput, ", ]", "]") MsgBox(0, "", $sOutput) Func _GetDiskNameByNumber($iDiskNumber) Local $iCount = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\disk\Enum", "Count") Local $sDiskKey = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\disk\Enum", String($iDiskNumber)) If @error Then Return SetError(1, 0, 0) Local $sDiskName = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" & $sDiskKey, "FriendlyName") If $sDiskName = "" Then $sDiskName = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" & $sDiskKey, "DeviceDesc") Return $sDiskName EndFunc1 point
-
David1337, Please note, _GUICtrlListView_FindText finds the first occurrence of the search text. kylomas1 point
-
Synchronize Scrolling Multiple ListViews?
argumentum reacted to mikell for a topic
Here is my try ... #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiScrollBars.au3> $hGUI = GUICreate("Synchro Pair - 2.0 ???", 455, 240, -1, -1) $cLV_1 = GUICtrlCreateListView("LV_1 A|B|C|D|E|F|G|H|I|J|K|L", 5, 5, 190, 220) $hLV_1 = GUICtrlGetHandle($cLV_1) $cLV_2 = GUICtrlCreateListView("LV_2 A|B|C|D|E|F|G|H|I|J|K|L", 240, 5, 190, 220) $hLV_2 = GUICtrlGetHandle($cLV_2) GUISetState() For $i = 1 To 40 $s = "" For $n = 0 To 10 $s &= "Item " & $i & " " & Chr(Asc("A") + $n) & "|" Next GUICtrlCreateListViewItem($s, $cLV_1) GUICtrlCreateListViewItem($s, $cLV_2) Next Global $aRect = _GUICtrlListView_GetItemRect($hLV_2, 0) Global Const $iDeltaY = $aRect[3] - $aRect[1] GUIRegisterMsg($WM_NOTIFY, "_WM_Notify") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hGUI) ExitLoop EndSwitch WEnd Func _WM_Notify($hWnd, $Msg, $wParam, $lParam) If $cLV_2 = $wParam Then ; to make both scrollers work $x1 = _GUIScrollBars_GetScrollPos($hLV_1, $SB_HORZ) $x2 = _GUIScrollBars_GetScrollPos($hLV_2, $SB_HORZ) Local $iLines = _GUICtrlListView_GetTopIndex($hLV_2) - _GUICtrlListView_GetTopIndex($hLV_1) _GUICtrlListView_Scroll ($hLV_1, $x2-$x1, $iLines * $iDeltaY) EndIf If $cLV_1 = $wParam Then $x1 = _GUIScrollBars_GetScrollPos($hLV_1, $SB_HORZ) $x2 = _GUIScrollBars_GetScrollPos($hLV_2, $SB_HORZ) Local $iLines = _GUICtrlListView_GetTopIndex($hLV_1) - _GUICtrlListView_GetTopIndex($hLV_2) _GUICtrlListView_Scroll ($hLV_2, $x1-$x2, $iLines * $iDeltaY) EndIf Return "GUI_RUNDEFMSG" EndFunc ;==>_WM_Notify1 point -
davis1337, Do not forget that there is a ListView UDF as well as the native functions: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Example() Func Example() GUICreate("listview items", 300, 300, -1, -1) Local $idListview = GUICtrlCreateListView("col1", 10, 10, 200, 150) ;,$LVS_SORTDESCENDING) Local $idButton = GUICtrlCreateButton("ID_of_Xitem?", 75, 170, 70, 20) Local $idItem1 = GUICtrlCreateListViewItem("Aitem", $idListview) Local $idItem2 = GUICtrlCreateListViewItem("Xitem", $idListview) Local $idItem3 = GUICtrlCreateListViewItem("Zitem", $idListview) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton $nID = _GUICtrlListView_FindText($idListview, "Xitem") MsgBox(0, "", "ID of Xitem is " & $nID) _GUICtrlListView_ClickItem($idListview, $nID) EndSwitch WEnd EndFunc ;==>Example M231 point
-
1 point
-
or BitOR($ES_PASSWORD, $GUI_SS_DEFAULT_INPUT)1 point
-
With using $ES_Password you have dropped all other default style values. You need to add them using something like this: #include <GUIConstantsEx.au3> #include <EditConstants.au3> GUICreate("Password Test", 500, 200) $Input = GUICtrlCreateInput("Password", 10, 20, 40, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL)) $OK = GUICtrlCreateButton("OK", 60, 20, 40, 20) GUISetState(@SW_SHOW, "Password Test") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE, "Password Test") ExitLoop Case $OK MsgBox(0, "Password", "Password has " & StringLen(GUICtrlRead($Input)) & " characters!") EndSwitch WEnd BTW: When posting code, please post a fully working script with all needed includes etc. Makes testing much easier und faster1 point
-
Your code looks too complex to me. You should really add few comments so that others (me - for example) can understand what are you trying to do with each step. Things that look obvious to you may not be that obvious to others. Aside from that, why don't you use WinHttp.au3 in more advanced way? The UDF is probably smarter than you think it is. For example, I just used this code to pick a pic from my comp and upload it to a group: #include "WinHttp.au3" Global Const $sFB_Email = "yaEmail.@domain.com" ;<- your email here Global Const $sFB_sPassword = "p@$$w0rd" ;<- your password here $sGroupID = "5555555555555555" ; group ID you want to post to $sPic = FileOpenDialog("Choose Pic to post", "", "Image (*.jpg;*.png;*.gif;*.bmp)"); choose a file you want to post If $sPic Then ConsoleWrite(FB_PostPicToGroup($sGroupID, $sPic) & @CRLF) Func FB_PostPicToGroup($sGroupID, $sPic) Local $iSuccess = 0 ; preset output (failure) ; Open session Local $hOpen = _WinHttpOpen() ; Connect Local $hConnect = _WinHttpConnect($hOpen, "https://m.facebook.com/") ; Login first (by filling login form) Local $sRead = _WinHttpSimpleFormFill($hConnect, _ ; connection handle "login.php", _ ; target page "login_form", _ ; form identifier "name:email", $sFB_Email, _ ; first field identifier paired with field data "name:pass", $sFB_sPassword) ; second field identifier paired with data ; Check for errors If Not @error And @extended = $HTTP_STATUS_OK Then ; Navigate to the Group and ask for pic upload Local $aRead = _WinHttpSimpleFormFill($hConnect, _ ; connection handle "/groups/" & $sGroupID, _ ; target page "index:1", _ ; form identifier (by index here, because id or name doesn't exist) "name:view_photo", True, _ ; identify submit control and click it "[RETURN_ARRAY]") ; return array because current URL is needed ; Check for errors If Not @error And @extended = $HTTP_STATUS_OK Then ; Read current URL (go with the flow) Local $aURL = _WinHttpCrackUrl($aRead[2]) If Not @error Then ; check for error ; Upload file $aRead = _WinHttpSimpleFormFill($hConnect, _ ; connection handle $aURL[6] & $aURL[7], _ ; target page Default, _ ; form identifier (default is used for simplicity because it's the only form on that page) "name:file1", $sPic, _ ; form field used for file "[RETURN_ARRAY]") ; return array because current URL is needed ; Check for errors If Not @error And @extended = $HTTP_STATUS_OK Then ; Read current URL now $aURL = _WinHttpCrackUrl($aRead[2]) ; check for error If Not @error Then ; Finally submit the post _WinHttpSimpleFormFill($hConnect, _ ; connection handle $aURL[6] & $aURL[7], _ ; target page Default, _ "name:view_post", True) If Not @error And @extended = $HTTP_STATUS_OK Then $iSuccess = 1 EndIf EndIf EndIf EndIf EndIf ; Close handles _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Bye... Return $iSuccess EndFunc Does it do what you want it to do?1 point
-
_Excel_BookOpen issue - (Moved)
antonioj84 reacted to water for a topic
Because the problem is not caused by a missing COM error but by an AutoIt bug. In the first post the problem is caused when accessing a property of an object that doesn't exist. Add the following function to your script and replace _Excel_BookOpen with _Excel_BookOpenEX. Func _Excel_BookOpenEX($oExcel, $sFilePath, $bReadOnly = Default, $bVisible = Default, $sPassword = Default, $sWritePassword = Default, $bUpdateLinks = Default) ; Error handler, automatic cleanup at end of function Local $oError = ObjEvent("AutoIt.Error", "__Excel_COMErrFunc") #forceref $oError If Not IsObj($oExcel) Or ObjName($oExcel, 1) <> "_Application" Then Return SetError(1, @error, 0) If Not FileExists($sFilePath) Then Return SetError(2, 0, 0) If $bReadOnly = Default Then $bReadOnly = False If $bVisible = Default Then $bVisible = True Local $oWorkbook = $oExcel.Workbooks.Open($sFilePath, $bUpdateLinks, $bReadOnly, Default, $sPassword, $sWritePassword) If @error Then Return SetError(3, @error, 0) Local $oWindow = $oExcel.Windows($oWorkbook.Name) ; <== Modified If IsObj($oWindow) Then $oWindow.Visible = $bVisible ; <== Modified ; If a read-write workbook was opened read-only then set @extended = 1 If $bReadOnly = False And $oWorkbook.Readonly = True Then Return SetError(0, 1, $oWorkbook) Return $oWorkbook EndFunc ;==>_Excel_BookOpen1 point -
IE click link by href
SkysLastChance reacted to someone for a topic
Take a look at the example for _IELinkGetCollection. Essentially, you are getting reference to the collection of all links, looping through, and when the .href = the .href of the link you want, clicking on it. See my modified example below; #include <IE.au3> $oIE = _IECreate("www.google.com") _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) Local $iNumLinks = @extended MsgBox(0, "Link Info", $iNumLinks & " links found") For $oLink In $oLinks MsgBox(0, "Link Info", $oLink.href) If $oLink.href = "http://www.youtube.com/?tab=w1" Then ;click on the youtube link _IEAction($oLink, "click") ExitLoop EndIf Next EDIT: If this method doesn't work, you need to be more specific about your problem.1 point