Jump to content

great77

Active Members
  • Posts

    38
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

great77's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks so much . This is what am looking for was trying to format the FileGetime but do not know that this bit below is the solution $arrFileTime = FileGetTime($strFileName, 1, 0)  ;; $strFileTime = $arrFileTime[0] & "/" & $arrFileTime[1] & "/" & $arrFileTime[2] & " " & $arrFileTime[3] & ":" & $arrFileTime[4] & ":" & $arrFileTime[5]
  2. ; put the root in a variable $sRoot = "C:\Project\PHexample\" Global $sCurrentTime = _NowCalc() ; We can use that variable here Global $aList = _FileListToArray($sRoot, Default, 2) If @error Then Exit ;;;;;;MsgBox(0, "Error", "_FileListToArray returned @error = " & @error) ;;;;;;;;;;;This is a loop that runs from 1 to the number of items listed in the first element of the returned  array For $i = 1 To UBound($aList) - 1     MsgBox(0, "Folder date", $sRoot & "" & $aList[$i] & @CRLF & @CRLF & FileGetTime($sRoot & "" & $aList[$i], 1, 1))     MsgBox(0, "Folder date", FileGetTime($sRoot & "" & $aList[$i], 1, 1))      $a_filenew = StringReplace(StringReplace(StringReplace(_NowCalc(), "/", ""), ":", ""), " ", "")       MsgBox(0, "Folder date", $a_filenew) $adex =  _DateDiff('D', FileGetTime($sRoot & "" & $aList[$i], 1, 1), $a_filenew)  MsgBox(0,"ade", $adex) Next I have a code as seen above, but the difference in time is returning zero. I understand that the date yyyymmddhhmmss but how can I find the difference. The purpose is to try find the difference in days. Any suggestion?
  3. Wow. Thanks ! It works !
  4. sleep(1000) $avoid_overwrite = _FileListToArray("D:\Automation\A_List\aa_024", Default, 2) ; the 2 is to return folders only If @error Then Exit ;;;;;;;;MsgBox(0, "Error", "_FileListToArray returned @error = " & @error) sleep(2000) For $avoid_index = 1 to UBound($avoid_overwrite) - 1 And $parent = 1 To 100 Step 1 MsgBox(0, "Error", $avoid_overwrite[$avoid_index] & $parent& @error) DirMove("D:\Automation\A_List\aa_024\" & $avoid_overwrite[$avoid_index] , "D:\Automation\temp_process\" & $parent, 1) sleep(4000) Next I have a problem with using AND to help in looping moving the folders with subfolders. The folders to move must maintain the structure and also am avoiding duplicate especially when Dirmove with 0(do not overwrite) is misbehaving. Can anyone tell me how I can use these 2 loop function becuase the FOR can not be nested. Help and suggestions highly appreciated
  5. Thanks is working . Thanks for the correction. The exit was in the same line with then if $dif >= 15000 then      exit
  6. I have a loop that is working perfectly, however I want to set the timer. I do not know why the timer is not working in this instance. Please see the code below : #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Opt("MouseCoordMode", 0) AutoItSetOption('PixelCoordMode', 0) ;Uses pixel coords relative to the defined Window; Utilizes pixel coords based on the entire window in which you are active in. #include <GUIConstantsEx.au3> #include <GUIComboBox.au3> #include <array.au3> #include <Timers.au3> #include <File.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <date.au3> $begin = TimerInit() ;This is just a timer. Imagine starting a stop watch here. $begin is the name of the "stop watch" While 1 WinActivate("Load and Store New Data") sleep(1000) ControlClick("Load and Store New Data", "", "[CLASS:ThunderRT6DirListBox; INSTANCE:1]", "left", 2, 28, 7)  ;; flight download for the home page ControlClick("Load and Store New Data", "", "[CLASS:ThunderRT6DirListBox; INSTANCE:1]", "left", 2, 28, 7)  ;; flight download for the home page sleep(1000) ControlClick("Load and Store New Data", "", "[CLASS:ThunderRT6DirListBox; INSTANCE:1]", "left", 2, 41, 22) ControlClick("Load and Store New Data", "", "[CLASS:ThunderRT6DirListBox; INSTANCE:1]", "left", 2, 41, 22) $dif = TimerDiff($begin) if $dif >= 120000 then exit Wend What is the problem. Is there other option apart from TimerDiff. Thanks
  7. It is now working. Cheers !
  8. Thanks Water and Melba23. Now I understand the array is not returning anything. That was why it was giving the error.
  9. I did not do that. How will I do that ? Thanks for your time
  10. I have a script which was working for months. But somehow is throwing this error "subscript used on non accessible variable" ReDim $aArray2D[$aArray[0]+1][2] ReDim $aArray2D[$aArray^ ERROR I used the Ubound but still not workinbg. How can I used uBound on this For $i = 1 TO Ubound ($aArray[0]) - 1 . It seems am not getting around this and why this error when it was working before. Global $spath = "C:\Automation\Air_List\unassigned" $Extract = "C:\Automation\Air_List\urgent" $checkpath = StringRegExp($spath,"^.+\\$",0) If $checkpath = 0 Then $spath = $spath & "\" $aArray = _FileListToArray($spath, "*.RDF", 1) Global $aArray2D[10][2] ReDim $aArray2D[$aArray[0]+1][2] $aArray2D[0][0] = $aArray[0] sleep(100) For $i = 1 TO $aArray[0] $aArray2D[$i][0] = $aArray[$i] $aArray2D[$i][1] = FileGetTime($spath & "\" & $aArray[$i],1,1) ;;;0=Last modified, 1=created, 2=last accessed FileGetTime ( "filename" [, option = 0 [, format = 1 return string and 0 rerturn array]] ) Next _ArraySort($aArray2D,1,1,"",1)
  11. Version 1.0.0

    1,014 downloads

    System Requirements : It will run on all windows operating system : Windows server 2003, 2008, 2012 and also Windows XP, 7,8,10 and other windows platform.This is full package of the software which includes Automatic webpage refreshment, Changing date stamp of files from one to many files or any extension type, File Management (Transfer files from data centre with network path and direct directory either by Date (from last to first modified date or from first to last modified date) and also by Name Computer Inventory- Display hardware and software information in text file and also can use to centralize all your computer information Automation to zip and unzip files and folders. Paste file to many folders Recycling Empty files and folders Searching files and folders Trim Filenames automatically (from end or beginning or combined) Note: If you are having problem using the application, do not hesitate to contact me or comment on it . I am still working on improving it and also adding some features. Computer Information Inventory program : The Files : Get Computer Detailes.exe - This application will create path C:\M-Omega containing two folders for hardware info and one for software info. You can use One2many tasks in Logmein to put info in that path for many computers. It can work to centralized about thousands of computers. Centralized_all_Computer_Details Folder : You will find 3 files in this folder. Right click the central.ini file and select Edit and change the path name in the file as Input1="\\network_path\pathfile\". Make sure all the computers have access to this share network path... Copy also the user_interface_combo in the same place where the \\network_path\pathfile is located. After this, select all the computers you will like to get their computer information. For example, if using Logmein, use one2many tasks. Double click the replicate_inifile.bat. This will copy the cenral.ini to all the required PC path into this location -- "C:\M-Omega\Config_centralize_inventory\central.ini". If your PC is not using C drive, then you can change the C drive to D or E or F which is available. Please note this is when you do not have C drive, that is when you can change the C Drive in the batch script to D or E or F You can now use other remote software such as LogmeIn (One2Many tasks) to run this application "Centralize_all_Computer_details.exe" on all your target computers selected. This will look for the network path you inputed into the central.ini file located in each computer and Within 1 minutes, the hardware and software info is generated on two folders on the network path provided. This can work on thousands of computers. User Interface Combo... This is GUI of the application which can help you interact with the software and hardware info in these folders. I have included files in these folders to understand how this combo GUI works. Make sure this file is located in the same place where you define your network path in the central.ini file.
  12. Thanks everyone using their time on this forum. Thanks to Melba23 for modifying his suggested script in these 2 programs. I posted this code to appreciate everything have learnt so far in this forum, Much appreciated. In my case, I tested these two scripts and they are working perfectly, but the one where $sText listed to compare with tooltip is preferred First Example ;;; This script listed the hidden tooltip and button number of hidden icon in the system tray and will allow the program to quickly see through the list without missing the tooltip. Local $MyFile ="C:\Program Files (x86)\AAD_Not_Connected\not connected.txt" Local $folder_not_connected = "C:\Program Files (x86)\AAD_Not_Connected\not connected_folder.txt" Global $hSysTray_Handle, $iSystray_ButtonNumber Local $not_connected, $reg, $PID Global $hSysTray_Handle Global $vIsHidden If ProcessExists("explorer.exe") Then ; Will return the PID or 0 if the process isn't found. ProcessClose("explorer.exe") EndIf $reg = 0 ;;; zer0 is ok but if large number for hexadecimal it should be converted see example below but commented out RegWrite("HKEY_CURRENT_USER64\Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "REG_DWORD", $reg) ;;;; RegWrite("HKEY_CURRENT_USER64\Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "REG_DWORD", "0x" & Hex(int($reg))) decimal can be converted to hexadecimal sleep(2000) $vIsHidden = RegRead("HKEY_CURRENT_USER64\Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray") sleep(10000) If $vIsHidden == 1 Then Run("rundll32.exe shell32.dll Options_RunDLL 5") WinWait("Notification Area Icons", "") sleep(500) ControlClick("Notification Area Icons", "", "[CLASS:Button; INSTANCE:3]") sleep(1000) ControlClick("Notification Area Icons", "", "[CLASS:Button; INSTANCE:1]") sleep(500) EndIf $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then ;;;; MsgBox(0, "Error", "Couldn't get the Tray handle") Exit EndIf Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) ;get button count If $iSystray_ButCount = 0 Then MsgBox(0, "Error", "No tray icons") Exit EndIf ;;; This will list all the system tray in the console and then identify to look for tooltip better than tooltip scripts ;;; give permission to easily delete folder with files with script $hSysTray_Handle = Get_Systray_Handle() ; Get systray item count $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "", "No items found in system tray") Exit EndIf ; Read tooltip text and parameter For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 $iParam = _GUICtrlToolbar_GetButtonParam($hSysTray_Handle, $iSystray_ButtonNumber) $sText = _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber) ConsoleWrite($iSystray_ButtonNumber & ": " & $iParam & " - " & $sText & @CRLF) If StringInStr( $sText, "Not Connected, Files") Then ;;; this will help to searcg for substring DirCreate("C:\Program Files (x86)\AAD_Not_Connected") $not_connected = DirCreate("C:\Program Files (x86)\AAD_Not_Connected") ;;;MsgBox(16, "AAD found", "System tray found") _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") ;;; no need to show right click sleep(2000) Local $hEventLog, $aData[4] = [3, 1, 2, 3] $hEventLog = _EventLog__Open("", "Application") _EventLog__Report($hEventLog, 4, 0, 17777, "", "Check if AAD is disconnected and triggered Event Log ID", $aData) _EventLog__Close($hEventLog) ;;;;FileCopy("C:\Windows\notepad.exe", $folder_not_connected, 1) sleep(1000) RunWait(@ComSpec & " /c " & ' @echo The AAD is not connected and will not transfer to GE as at : %DATE% - %time% >> "C:\Program Files (x86)\AAD_Not_Connected\not connected.txt" ', @TempDir, @SW_HIDE) sleep(2000) FileWrite($MyFile, "The AAD is not connected and will not transfer to company" & " Details: " & @ComputerName & " as at " & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @SEC) ExitLoop ;;; very important Else DirRemove("C:\Program Files (x86)\AAD_Not_Connected", 1) ;;;;;;;;; MsgBox(16, "NOT found AAD", "AAD Not found") EndIf Next If $vIsHidden == 0 Then Run("rundll32.exe shell32.dll Options_RunDLL 5") WinWait("Notification Area Icons", "") sleep(500) ControlClick("Notification Area Icons", "", "[CLASS:Button; INSTANCE:3]") sleep(500) ControlClick("Notification Area Icons", "", "[CLASS:Button; INSTANCE:1]") sleep(500) EndIf Func Get_Systray_Handle() $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") DirRemove("C:\Program Files (x86)\AAD_Not_Connected", 1) Exit Else Return $hSysTray_Handle EndIf EndFunc The Second one : ;;;; The second one is working, but might not find icon inactive for long time in the system tray, however. It can still find the hidden icon, but some icons are sometimes made redundant by wiindows and might not be able find it by the program Local $MyFile ="C:\Program Files (x86)\AAD_Not_Connected\not connected.txt" Local $folder_not_connected = "C:\Program Files (x86)\AAD_Not_Connected\not connected_folder.txt" Global $hSysTray_Handle, $iSystray_ButtonNumber Local $not_connected, $reg, $PID Global $hSysTray_Handle Global $vIsHidden If ProcessExists("explorer.exe") Then ; Will return the PID or 0 if the process isn't found. ProcessClose("explorer.exe") EndIf $reg = 0 ;;; zer0 is ok but if large number for hexadecimal it should be converted see example below but commented out RegWrite("HKEY_CURRENT_USER64\Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "REG_DWORD", $reg) ;;;; RegWrite("HKEY_CURRENT_USER64\Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "REG_DWORD", "0x" & Hex(int($reg))) decimal can be converted to hexadecimal sleep(2000) $vIsHidden = RegRead("HKEY_CURRENT_USER64\Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray") sleep(10000) If $vIsHidden == 1 Then Run("rundll32.exe shell32.dll Options_RunDLL 5") WinWait("Notification Area Icons", "") sleep(500) ControlClick("Notification Area Icons", "", "[CLASS:Button; INSTANCE:3]") sleep(1000) ControlClick("Notification Area Icons", "", "[CLASS:Button; INSTANCE:1]") sleep(500) EndIf $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then ;;;; MsgBox(0, "Error", "Couldn't get the Tray handle") Exit EndIf Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) ;get button count If $iSystray_ButCount = 0 Then MsgBox(0, "Error", "No tray icons") Exit EndIf ;;;;MsgBox(0, "Tray icons", $iSystray_ButCount) Global $sToolTipTitle = "Not Connected, Files" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here $not_connected = DirCreate("C:\Program Files (x86)\AAD_Not_Connected") ;;; give permission to easily delete folder with files with script ;;;Global $sToolTipTitle2 = "Not Connected, Files outstanding:" $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) ;;;$iSystray_ButtonNumber2 = Get_Systray_Index($sToolTipTitle2) If $iSystray_ButtonNumber = 0 Then ;;;;; MsgBox(16, "Error", "Icon not found in system tray") sleep(3000) DirRemove("C:\Program Files (x86)\AAD_Not_Connected", 1) ; 1 means the file not connected.txt will be deleted ;;; Exit Else Sleep(2000) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") ;;; no need to show right click sleep(2000) Local $hEventLog, $aData[4] = [3, 1, 2, 3] $hEventLog = _EventLog__Open("", "Application") _EventLog__Report($hEventLog, 4, 0, 17777, "", "Check if AAD is disconnected and triggered Event Log ID", $aData) _EventLog__Close($hEventLog) ;;;;FileCopy("C:\Windows\notepad.exe", $folder_not_connected, 1) sleep(1000) RunWait(@ComSpec & " /c " & ' @echo The AAD is not connected and will not transfer to GE as at : %DATE% - %time% >> "C:\Program Files (x86)\AAD_Not_Connected\not connected.txt" ', @TempDir, @SW_HIDE) sleep(2000) FileWrite($MyFile, "The AAD is not connected and will not transfer to " & " Details: " & @ComputerName & " as at " & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @SEC) EndIf sleep(3000) ;;If $iSystray_ButtonNumber2 = 0 Then ;; MsgBox(16, "Error", "Icon not found in system tray") ;; Exit ;;Else ;Sleep(2000) ;;_GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber2, "right") ;;EndIf ;............ Func Get_Systray_Index($sToolTipTitle) ; Find systray handle $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then ;; MsgBox(16, "Error", "System tray not found") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then ;;MsgBox(16, "Error", "No items found in system tray") Exit EndIf ; Look for wanted tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc If $vIsHidden == 0 Then Run("rundll32.exe shell32.dll Options_RunDLL 5") WinWait("Notification Area Icons", "") sleep(500) ControlClick("Notification Area Icons", "", "[CLASS:Button; INSTANCE:3]") sleep(500) ControlClick("Notification Area Icons", "", "[CLASS:Button; INSTANCE:1]") sleep(500) EndIf
  13. Yea thanks. Your support helps greatly. Cheers Kylomas
  14. Thank you so much. it works to drop the column that has value 2, The new code after I change the B column to C column and add ; the $cmd2 &= '[' to start the parenthesis. Many thanks Local $oExcel = _Excel_Open() if @error then exit msgbox(17,'Excel Error', 'COM error code is ' & @extended) local $oWorkbook = _Excel_BookOpen($oExcel, $myfile, false, false) if @error then exit msgbox(17,'BookOpen Error', 'ERROR code is ' & @ERROR) local $aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:C"), 2, False) ;; 2 return formulat and True, transpose if @error then exit msgbox(17,'RangeRead Error', 'ERROR code is ' & @ERROR) _Excel_Close($oExcel) if @error then exit msgbox(17,'Close Error', 'ERROR code is ' & @ERROR) _arraydisplay($aResult) local $cmd2 ='{"hostIds":' $cmd2 &= '[' ; i added this to start the paarenthesis for $y = 3 to ubound($aResult) - 1 if $aResult[$y][2] <> '2' then ;;; COLUMN 2 IS C COLUMN IF CORRUPT STATUS IS 2 $cmd2 &= $aResult[$y][0] & ( $y = ubound($aResult)-1 ? '' : ',' ) Else ConsoleWrite('Dropped HostID = ' & $aResult[$y][0] & @CRLF) endif Next $cmd2 &= ']}' MsgBox(0, 0, $cmd2)
×
×
  • Create New...