Jump to content

autoitxp

Active Members
  • Posts

    304
  • Joined

  • Last visited

autoitxp's Achievements

Universalist

Universalist (7/7)

0

Reputation

  1. its loop to check fixed drives and fixed labels almost 500. drives keep coming online and going my I am trying to get array of drives at gr8 speed as possible some of drives also need to block from displaying as above example A: AND B:
  2. @BrewManNH thanks resting $strerrors= 0 works
  3. if you can put code here by using @Subz _example1().
  4. @Subz First example is good as not using redim in loop thanks
  5. @BrewManNH i'm getting error after compiling trace back line For $GF In $GFS But when run as normal in Scite works fine after compiling getting below error Error:Array variable has incorrect number of subscripts or subscript dimension range exceeded. Global $GFL[10000] Func _STF()     $ObjSS = ObjCreate("Schedule.Service")     $ObjSS.Connect()     $GetFP = "\Microsoft\Windows"     If $GetFP = "\" Then $GetFP = ""     $GFolder = $ObjSS.GetFolder($GetFP)     $GFS = $GFolder.GetFolders(0)     For $GF In $GFS         $strerrors += 1         $GFL[$strerrors] = $GetFP & "\" & $GF.Name     Next     ReDim $GFL[$strerrors + 1]     If $g_eventerror Then         $g_eventerror = 0         Return SetError(@error)     EndIf     Return $GFL EndFunc   ;==>_STF
  6. Subz what if i don't need to use _arrayadd as _arrayadd use redim in loop any other way to delete array and fetch correct array on call
  7. im getting error array variable has incorrect number of subscripts ..... Func _STF()     $ObjSS = ObjCreate("Schedule.Service")     $ObjSS.Connect()     $GetFP = "\Microsoft\Windows"     If $GetFP = "\" Then $GetFP = ""     $GFolder = $ObjSS.GetFolder($GetFP)     $GFS = $GFolder.GetFolders(0)     ReDim $GFL[$GFS.Count]     For $GF In $GFS         $GFL[$strerrors] = $GetFP & "\" & $GF.Name         $strerrors += 1     Next     If $g_eventerror Then         $g_eventerror = 0         Return SetError(@error)     EndIf     Return $GFL EndFunc   ;==>_STF on other hand im not getting $GFS.Name getting unknown name error ? Func _STF() $ObjSS = ObjCreate("Schedule.Service")     $ObjSS.Connect()     $GetFP = "\Microsoft\Windows"     If $GetFP = "\" Then $GetFP = ""     $GFolder = $ObjSS.GetFolder($GetFP)     $GFS = $GFolder.GetFolders(0)     ReDim $GFL[$GFS.Count]     For $i = 0 To $GFS.Count - 1         $GFL[$i] = $GetFP & "\" & $GFS.Name     Next     If $g_eventerror Then         $g_eventerror = 0         Return SetError(@error)     EndIf     Return $GFL EndFunc  ;==>_STF
  8. _ArrayAdd() work with object collection? than gr8 i will try
  9. Although this function works correctly but bit slower may b bec of Redim any other way to do which is faster. Fetching more than 500 Schedule task in specified folder . #include <Array.au3> Global $g_eventerror = 0 Global $oMyError = ObjEvent("AutoIt.Error", "_MyErrFunc") Global $err Global $GetFP Global $GFolder Global $GFS Global $GF Global $GFL[0] Global $strerrors = 0 Global $ObjSS _ArrayDisplay(_STF()) Func _STF()     $ObjSS = ObjCreate("Schedule.Service")     $ObjSS.Connect()     $GetFP = "\Microsoft\Windows"     If $GetFP = "\" Then $GetFP = ""     $GFolder = $ObjSS.GetFolder($GetFP)     $GFS = $GFolder.GetFolders(0)     For $GF In $GFS         $strerrors += 1         ReDim $GFL[$strerrors + 1]         $GFL[$strerrors] = $GetFP & "\" & $GF.Name     Next     If $g_eventerror Then         $g_eventerror = 0         Return SetError(@error)     EndIf     Return $GFL EndFunc   ;==>_STF Func _MyErrFunc($oMyError)     ConsoleWrite(@LF & "---------------------------------------------------------------------" & @LF & _             " Source: " & $oMyError.source & @LF & _             " Description: " & $oMyError.description & @LF & _             " Windescription: " & $oMyError.windescription & @LF & _             " Number: " & $oMyError.number & @LF & _             " Retcode: " & $oMyError.retcode & @LF & _             " Scriptline: " & $oMyError.scriptline & @LF & _             " Helpfile: " & $oMyError.helpfile & @LF & _             " Helpcontext: " & $oMyError.helpcontext & @LF & _             " Lastdllerror: " & $oMyError.lastdllerror & @LF & _             "---------------------------------------------------------------------" & @LF)     $err = $oMyError.number     If $err = 0 Then $err = -1     $g_eventerror = $err ; to check for after this function returns EndFunc   ;==>_MyErrFunc
  10. Thanks !   #include <Array.au3> Global $RemDL Global $dt[0] Func _DriveR()     $RemDL = DriveGetDrive($DT_ALL)     If @error Then Return SetError(-1)     For $i = 1 To UBound($RemDL) - 1         If $RemDL[$i] = "A:" Or $RemDL[$i] = "B:" Then ContinueLoop         _ArrayAdd($dt, $RemDL[$i])         If @error Then Return SetError(-1)     Next     If UBound($dt) = 0 Then Return SetError(-1)     Return $dt EndFunc   ;==>_DriveR
  11.        Global $RemDL        Global $dt[0]     $RemDL = DriveGetDrive($DT_FIXED)     If  NOT @error Then      For $i = 0 To UBound($RemDL) - 1         ReDim $dt[$i + 1]         $dt[$i] = StringReplace(StringReplace(StringUpper($RemDL[$i]), "C:", ""), "F:", "")         If $dt[$i] = "" Then ReDim $dt[$i - 1]    Next     _ArrayDisplay($dt) endif Trying to get fix drives as array in proper manner got 4 drives (c: d: e: f:) but getting 5 rows as array which i want to display as 2 drives (2 rows) only d: and e:
  12. #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <WinAPIConv.au3> #include <WindowsConstants.au3> Global $g_hEdit OnAutoItExitRegister("_OnExit")  Example() Func Example()     Local $hGUI     $hGUI = GUICreate("Edit Create", 400, 300)     $g_hEdit = _GUICtrlEdit_Create($hGUI, "This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)     GUISetState(@SW_SHOW)     _GUICtrlEdit_AppendText($g_hEdit, @CRLF & "Append to the end?")         Do     Until GUIGetMsg() = $GUI_EVENT_CLOSE     GUIDelete() EndFunc   ;==>Example     Func _OnExit()     MsgBox(0, '' , _GUICtrlEdit_GetText(  $g_hEdit))     EndFunc I'm using windows 10 _OnExit function _GuictrlEdit_GetText() getting empty string ? what is issue ?
  13. This is part of my script . I need to know how to rename or change upload.zip file name to desired one i tryed using $_POST method but unsuccessful php code <?php print_r($_POST); print_r($_FILES); copy($_FILES["upload"]["tmp_name"], "upload.zip"); ?> ConsoleWrite(_PHPupload('192.168.1.2', _OSmacros(), 89, '/upload/index.php', 'application/zip') & @CRLF) Func _PHPupload($pIP, $pMacros, $pPort, $phpPath, $pContent) If FileExists($pFile) = 0 Then Return SetError(1, 1, '') $pTcpc = TCPConnect($pIP, $pPort) If @error Then Return SetError(1, 2, '') Local $pBound = "-----" & Random(10000000, 99999999, 1) Local $pData1 = "--" & $pBound & @CRLF $pData1 &= 'Content-Disposition: form-data; name="upload"; filename="' & $pFile & '"' & @CRLF & 'Content-Type: ' & $pContent & @CRLF & @CRLF Local $pData2 = @CRLF & "--" & $pBound & @CRLF & 'Content-Disposition: form-data ;name="test"' & @CRLF & @CRLF & "variable" & @CRLF $pData2 &= "--" & $pBound & "--" & @CRLF & @CRLF Local $pHeader = 'POST ' & $phpPath & ' HTTP/1.1' & @CRLF $pHeader &= 'Host: ' & $pIP & @CRLF $pHeader &= 'User-Agent: ' & $pMacros & @CRLF $pHeader &= 'Content-Type: multipart/form-data; boundary=' & $pBound & @CRLF $pHeader &= 'Content-Length: ' & (StringLen($pData1) + StringLen($pData2) + FileGetSize($pFile)) & @CRLF & @CRLF Local $pFopen = FileOpen($pFile, $FO_READ) If $pFopen = -1 Then Return SetError(1, 3, '') Local $sFread = FileRead($pFopen) TCPSend($pTcpc, $pHeader & $pData1 & $sFread & $pData2) If @error Then Return SetError(1, 4, '') Local $pBuffer = "" While 1 $pBuffer &= TCPRecv($pTcpc, 1024) If @error Then Return SetError(1, 5, '') Else ExitLoop EndIf WEnd MsgBox(64, "", $pBuffer) EndFunc ;==>_PHPupload
  14. ​Using simple ftp server IIS 7.5 on windows 7 sp1 ultimate USING port range 49900-50000 NAT forwarded, allowed in firewall and ftp port which is 50100 i am not using port range below 1024 and using above simple script to test if it upload my file or not #include <FTPEx.au3> Local $sServer = 'xx.47.250.xxx' Local $sUsername = 'Admin' Local $sPass = '1234' Local $sport = 50100 Local $hOpen = _FTP_Open('MyFTP') Local $hConn = _FTP_Connect($hOpen, $sServer, $sUsername, $sPass, 1 ,$sport) local $put = _FTP_FilePut ( $hConn, @ScriptDir & "\" &@ScriptName, "/Remote.au3" ) if $put = 0 then MsgBox(0 , '', @error) Else MsgBox(0 ,'' , 'uploaded sucsses... deleteing now!') _FTP_FileDelete ( $hConn, "/Remote.au3" ) endif sleep(1000) Local $iFtpc = _FTP_Close($hConn) Local $iFtpo = _FTP_Close($hOpen)nothing uploaded and shows same IIS error log above mentioned
×
×
  • Create New...