marcsusy
Active Members-
Posts
56 -
Joined
-
Last visited
marcsusy's Achievements
Wayfarer (2/7)
0
Reputation
-
hello I adapted a script to change color items but does not work can someone help. Please my script is as follows: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <FontConstants.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 272, 264, 75, 25) $ListView1 = GUICtrlCreateListView("nº | col1 | col2 | col3 " , 72, 88, 474, 150, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 30) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 150) _GUICtrlListView_GetColumn($ListView1, 0) _GUICtrlListView_JustifyColumn($ListView1, 0, 2) _GUICtrlListView_GetColumn($ListView1, 1) _GUICtrlListView_JustifyColumn($ListView1, 1, 2) _GUICtrlListView_GetColumn($ListView1, 2) _GUICtrlListView_JustifyColumn($ListView1, 1, 0) _GUICtrlListView_GetColumn($ListView1, 3) _GUICtrlListView_JustifyColumn($ListView1, 1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $Font1 = _WinAPI_CreateFont(14, 6, 0, 0, $FW_BOLD),$iItem Global $Font2 = _WinAPI_CreateFont(14, 6, 0, 0, $FW_BOLD, True) For $a = 1 to 200 IF Mod($a, 2) = 0 Then $Var = "stock " $Var1 = "not out" $Var2 = "Color Blue" Else $Var = "no stock" $Var1 = "exhausted" $Var2 = "Color Red" Endif GUICtrlCreateListViewItem($a &"|" &$Var&"|"&$Var1&"|"&$Var2, $ListView1) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $iItem = 0 to _GUICtrlListView_GetItemCount($ListView1) IF _GUICtrlListView_GetItemText($ListView1,$iItem,1) = "no stock" Then GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") Endif Next _WinAPI_DeleteObject($Font1) _WinAPI_DeleteObject($Font2) EndSwitch WEnd Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $ListView1 Switch $iCode Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $iDrawStage = DllStructGetData($tCustDraw, "dwDrawStage") If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW If $iDrawStage = $CDDS_ITEMPREPAINT Then Return $CDRF_NOTIFYSUBITEMDRAW Local $iSubItem = DllStructGetData($tCustDraw, "iSubItem") Local $iItem = DllStructGetData($tCustDraw, "dwItemSpec") Local $iColor, $hDC Switch $iItem Case 0 $hDC = DllStructGetData($tCustDraw, "hdc") $iColor = 0x5555DD _WinAPI_SelectObject($hDC, $Font1) DllStructSetData($tCustDraw, "clrText", $iColor) Return $CDRF_NEWFONT EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
-
Problems with Function _Timer_SetTimer one please help
marcsusy replied to marcsusy's topic in AutoIt GUI Help and Support
I am sorry Melba the progress is stop when I press the botom $Button1,maybe do something wrong #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 264, 312, 75, 25) $Progress1 = GUICtrlCreateProgress(88, 160, 478, 17, $PBS_MARQUEE) GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 50) ; final parameter is update time in ms GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _WMI() EndSwitch WEnd Func _WMI() $strComputer = "." $objWMIService = ObjGet("winmgmts:"& "{impersonationLevel=impersonate}!"& $strComputer & "rootcimv2") $colSoftware = $objWMIService.ExecQuery("Select * from Win32_Product") Local $Name[1],$Version[1] $i = 0 For $objSoftware in $colSoftware $Name[$i] = $objSoftware.Name $Version[$i] = $objSoftware.Version $i += 1 Redim $Name[$i+1] Redim $Version[$i+1] Next EndFunc Thanks -
Problems with Function _Timer_SetTimer one please help
marcsusy replied to marcsusy's topic in AutoIt GUI Help and Support
Sorry,I've tried my script, but no found the solution, help me please Thanks -
Problems with Function _Timer_SetTimer one please help
marcsusy replied to marcsusy's topic in AutoIt GUI Help and Support
Please have the link to download the portable version V3.3.10.0 -
Problems with Function _Timer_SetTimer one please help
marcsusy replied to marcsusy's topic in AutoIt GUI Help and Support
I'll try to V3.3.10.2 -
Problems with Function _Timer_SetTimer one please help
marcsusy replied to marcsusy's topic in AutoIt GUI Help and Support
I'm using version 3.3.0 the error is this : ERROR: syntax error $ iTimerProgress = _Timer_SetTimer ($ Form1, $ iwait, _UpdateProgressBar) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ -
Problems with Function _Timer_SetTimer one please help
marcsusy replied to marcsusy's topic in AutoIt GUI Help and Support
Hello I3ill I had tried calling the function without quotation marks, but I get syntax error Thanks -
Problems with Function _Timer_SetTimer one please help
marcsusy replied to marcsusy's topic in AutoIt GUI Help and Support
Hello I3ill: I have tried and does not work I may not do as you say, you can put me an example please. thanks Deshacer cambios -
Hi Everyone: I'm using a script that makes a pc software inventory, but GUICtrlCreateProgress does not work, I want to know I'm doing wrong. Greetings. This is the script I use: #include <Timers.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 264, 312, 75, 25) $Progress1 = GUICtrlCreateProgress(88, 160, 478, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $Form1,$iWait = 100,$direction = 1,$percent = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _WMI() EndSwitch WEnd Func _WMI() $iTimerProgress = _Timer_SetTimer($Form1, $iWait, "_UpdateProgressBar") $strComputer = "." $objWMIService = ObjGet("winmgmts:"& "{impersonationLevel=impersonate}!"& $strComputer & "rootcimv2") $colSoftware = $objWMIService.ExecQuery("Select * from Win32_Product") Local $Name[1],$Version[1] $i = 0 For $objSoftware in $colSoftware $Name[$i] = $objSoftware.Name $Version[$i] = $objSoftware.Version $i += 1 Redim $Name[$i+1] Redim $Version[$i+1] Next EndFunc Func _UpdateProgressBar($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $hWnd, $Msg, $iIDTimer, $dwTime $percent += 5 * $direction GUICtrlSetData($progress1, $percent) IF $percent = 100 Or $percent = 0 Then $direction *= -1 IF $percent = 100 Then GUICtrlSetColor($progress1, 0xff0000) ElseIf $percent = 0 Then GUICtrlSetColor($progress1, 0x0000ff) EndIf EndFunc
-
Error changing computer name using WMI. please help
marcsusy replied to marcsusy's topic in AutoIt General Help and Support
Water I get the error is $intRC 1323 -
Error changing computer name using WMI. please help
marcsusy replied to marcsusy's topic in AutoIt General Help and Support
I tried this new script at home and it works correctly, but at work it does not work, do not get any errors but does not change the hostname, I get the message failed, not why $strComputer = "HOST" $strNewComputer = "NEWHOST" $strDomainUser = "User" $strDomainPasswd = "pass" $strLocalUser = "HOSTAdminuser" $strLocalPasswd = "passadmin" $oErrorHandler = ObjEvent("AutoIt.Error","ObjErrorHandler") $objWMILocator = ObjCreate("WbemScripting.SWbemLocator") $objWMILocator.Security_.AuthenticationLevel = 6 $objWMIComp = $objWMILocator.ConnectServer($strComputer, _ "rootcimv2", _ $strLocalUser, _ $strLocalPasswd) $objWMICompSys = $objWMIComp.Get("Win32_ComputerSystem.Name='" & $strComputer & "'") $intRC = $objWMICompSys.Rename($strNewComputer, _ $strDomainPasswd, _ $strDomainUser) IF $intRC <> 0 then MsgBox(0,"","Fail") Else MsgBox(0,"","Successfully renamed") Endif Func ObjErrorHandler() Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oErrorHandler.description & @CRLF & _ "err.windescription:" & @TAB & $oErrorHandler.windescription & @CRLF & _ "err.number is: " & @TAB & hex($oErrorHandler.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oErrorHandler.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oErrorHandler.scriptline & @CRLF & _ "err.source is: " & @TAB & $oErrorHandler.source & @CRLF & _ "err.helpfile is: " & @TAB & $oErrorHandler.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oErrorHandler.helpcontext _ ) -
Error changing computer name using WMI. please help
marcsusy replied to marcsusy's topic in AutoIt General Help and Support
Thanks I' ll Tray, Water -
I'm trying to rename a computer in a domain and I get the following error: : ==> The requested action with this object has failed.: $rc = $objWMIComputerSystem.Rename($NewComputer,$sPassword,$sUserName)^ ERROR The script is used: $sHost = "HOST" $sDomain = "Domain" $sUserName = "User" $sPassword = "pass" $NewComputer = "NEW_HOST" $objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator") $objWMIComputer = $objSWbemLocator.ConnectServer($sHost, "rootcimv2", $sDomain&""&$sUserName, $sPassword) $objSWbemLocator.Security_.ImpersonationLevel = 3 $objWMIComputerSystem = $objWMIComputer.Get("Win32_ComputerSystem.Name='" &$sHost & "'") $rc = $objWMIComputerSystem.Rename($NewComputer,$sPassword,$sUserName) IF $rc <> 0 then MsgBox(0,"","failed") Else MsgBox(0,"","Successfully renamed") Endif
-
Hello everyone: I want to adapt this script to copy a local file to a remote computer but does not work. any ideas please. thanks strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2") Set colFolders = objWMIService.ExecQuery _ "SELECT * FROM Win_32 Directory WHERE Name = 'c:Scripts'") For Each objFolder in colFolders errResults = objFolder.Copy("D:Archive") Wscript.Echo errResults Next The script is adapted ; remote computer PC23 ; local file for copy c:WindowstempFile.bat ; remote folder C:windowsArchive $strComputer = "PC23" $objWMIService = ObjGet("winmgmts:" _ & "{impersonationLevel=impersonate}!" & $strComputer & "rootcimv2") $colFolders = $objWMIService.ExecQuery( _ "SELECT * FROM Win_32 Directory WHERE Name = 'c:WindowstempFile.bat'") For $objFolder in ·colFolders $errResults = objFolder.Copy("C:windowsArchive") MsgBox(0,"",""&$errResults) Next It does not work