Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. hi guys , i create a script for backup but when try to run with kaspersky active it reveal my script (compiled) like a virus pdm:trojan.win32.generic, but is not virus why ?? i know i can exclude , but i should the code will be correct #AutoIt3Wrapper_Compression=3 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #AutoIt3Wrapper_Add_Constants=n #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #RequireAdmin #include <Array.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <WinAPIFiles.au3> #include <File.au3> #include <Date.au3> #include <FileConstants.au3> #include <Process.au3> Global $sGSource = @ScriptDir & "\Sorgente.txt" Global $sGDestin = @ScriptDir & "\Destinazioni.ini" Global $backupDir, $sGIdRig _Backup_start() ; _ShadowCopyOFFeClean() ;_ShadowCopyON() ;_Kill_Prog() Func _pulisci() If @OSVersion <> "WIN_XP" Then While 1 If ProcessExists("cmd.exe") = 0 Then _ShadowCopyOFFeClean() ExitLoop EndIf Sleep(100) WEnd EndIf EndFunc ;==>_pulisci Func _Backup_start() If ProcessExists("cmd.exe") <> 0 Then ProcessClose("cmd.exe") EndIf _pulisci() Local $iLCtrl = _Controllo_esistenza_Sorce_Dest($sGSource, $sGDestin) If $iLCtrl = 0 Then Exit Else Local $iFileExists = FileExists("C:\temp") If $iFileExists = 0 Then DirCreate("C:\temp") EndIf _ShadowCopyON() Local $aLSource = FileReadToArray($sGSource) Local $sLPino = IniRead(@ScriptDir & "\Destinazioni.ini", "Pino", "key1", "nob") Local $sLKlizia = IniRead(@ScriptDir & "\Destinazioni.ini", "clizia", "key1", "nob") Local $sLAlbert = IniRead(@ScriptDir & "\Destinazioni.ini", "alberto", "key1", "nob") Local $sLTommy = IniRead(@ScriptDir & "\Destinazioni.ini", "tommaso", "key1", "nob") Local $sLFlam = IniRead(@ScriptDir & "\Destinazioni.ini", "flaminio", "key1", "nob") Local $sLSimo = IniRead(@ScriptDir & "\Destinazioni.ini", "simone", "key1", "nob") Local $sTime = _DateTimeFormat(_NowCalc(), 2) Local $rep1 = StringReplace($sTime, " ", "-") Local $rep2 = StringReplace($rep1, "/", "-") Local $rep3 = StringReplace($rep2, ":", "-") $rep3 = StringReplace($rep2, ":", "-") Local $TargetDir = "Backups\BACKUP-" & $rep3 Local $options = " /E /A-:R " Local $logpath = FileGetShortName(@DesktopDir) & "\Backup_log.txt" For $i = 1 To UBound($aLSource) - 1 Local $sLNameSaver = _LastNameOfPath($aLSource[$i]) Select Case $aLSource[0] = "pino" _3FolderMaximum($sLPino & "\Backups") If @OSVersion = "WIN_XP" Then _RoboKup($aLSource[$i], $sLPino & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) Else Local $sLOPathCorrectP = StringRegExpReplace($aLSource[$i], "C:", "C:\\temp\\freezer_shadowcopy") _RoboKup($sLOPathCorrectP, $sLPino & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) EndIf Case $aLSource[0] = "clizia" _3FolderMaximum($sLKlizia & "\Backups") If @OSVersion = "WIN_XP" Then _RoboKup($aLSource[$i], $sLKlizia & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) Else Local $sLOPathCorrectK = StringRegExpReplace($aLSource[$i], "C:", "C:\\temp\\freezer_shadowcopy") _RoboKup($sLOPathCorrectK, $sLKlizia & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) EndIf Case $aLSource[0] = "alberto" _3FolderMaximum($sLAlbert & "\Backups") If @OSVersion = "WIN_XP" Then _RoboKup($aLSource[$i], $sLAlbert & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) Else Local $sLOPathCorrectA = StringRegExpReplace($aLSource[$i], "C:", "C:\\temp\\freezer_shadowcopy") _RoboKup($sLOPathCorrectA, $sLAlbert & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) EndIf Case $aLSource[0] = "tommaso" _3FolderMaximum($sLTommy & "\Backups") If @OSVersion = "WIN_XP" Then _RoboKup($aLSource[$i], $sLTommy & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) Else Local $sLOPathCorrectT = StringRegExpReplace($aLSource[$i], "C:", "C:\\temp\\freezer_shadowcopy") _RoboKup($sLOPathCorrectT, $sLTommy & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) EndIf Case $aLSource[0] = "flaminio" _3FolderMaximum($sLFlam & "\Backups") If @OSVersion = "WIN_XP" Then _RoboKup($aLSource[$i], $sLFlam & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) Else Local $sLOPathCorrectF = StringRegExpReplace($aLSource[$i], "C:", "C:\\temp\\freezer_shadowcopy") _RoboKup($sLOPathCorrectF, $sLFlam & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) EndIf Case $aLSource[0] = "simone" _3FolderMaximum($sLSimo & "\Backups") If @OSVersion = "WIN_XP" Then _RoboKup($aLSource[$i], $sLSimo & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) Else Local $sLOPathCorrectS = StringRegExpReplace($aLSource[$i], "C:", "C:\\temp\\freezer_shadowcopy") _RoboKup($sLOPathCorrectS, $sLSimo & "\" & $TargetDir & "\" & $sLNameSaver, $options, $logpath) EndIf EndSelect Next If @OSVersion = "WIN_XP" Then Shutdown(5) EndIf EndIf EndFunc ;==>_Backup_start Func _LastNameOfPath($path) Local $aLName = StringSplit($path, "\") If IsArray($aLName) Then If $aLName[$aLName[0]] = "" Then Return $aLName[($aLName[0] - 1)] Else Return $aLName[$aLName[0]] EndIf Else MsgBox(16 + 262144, 'ERRORE N.001', 'ERRORE NEL FILE SORGENTE PROBABILE RIGA VUOTA ') EndIf EndFunc ;==>_LastNameOfPath Func _RoboKup($from, $to, $options, $logpath = 0) ;MsgBox(0,'','lancio robokup dimerda') If @OSVersion = "WIN_XP" Then Local $sLRoboFileDir = FileGetShortName(@ProgramFilesDir & '\Windows Resource Kits\Tools\robocopy.exe ') Local $sLFromShort = FileGetShortName($from) Local $sLToShort = FileGetShortName($to) ;ConsoleWrite($logpath & @CRLF) Local $sLOptShort = FileGetShortName($options) ;MsgBox(0, '', $sLRoboFileDir) If $logpath = Default Then $logpath = 0 If FileExists($sLRoboFileDir) Then Run(@ComSpec & ' /c ' & $sLRoboFileDir & ' ' & $sLFromShort & ' ' & $sLToShort & ' ' & $sLOptShort & ' /LOG:' & $logpath, '', @SW_HIDE) ;Run(@ComSpec & ' /k ' & $sLRoboFileDir & ' ' & $sLFromShort & ' ' & $sLToShort & ' ' & $sLOptShort & ' /LOG:' & $logpath);, '', @SW_HIDE) Else MsgBox(0, 'Info', 'Devi installare il robocopy') ShellExecute("https://www.microsoft.com/en-us/download/details.aspx?id=17657") EndIf Else ; other windows 7 8 10... If $logpath = Default Then $logpath = 0 If FileExists(@SystemDir & '\robocopy.exe') Then Run(@ComSpec & ' /c ' & @SystemDir & '\robocopy.exe ' & $from & ' ' & $to & ' ' & $options & ' /LOG:' & $logpath, '', @SW_HIDE) ;Run(@ComSpec & ' /k ' & @SystemDir & '\robocopy.exe ' & $from & ' ' & $to & ' ' & $options & ' /LOG:' & $logpath) ;, '', @SW_HIDE) ConsoleWrite(@SystemDir & '\robocopy.exe ' & $from & ' ' & $to & ' ' & $options & ' /LOG:' & $logpath) Else MsgBox(0, 'Info', 'Devi installare il robocopy') ShellExecute("https://www.microsoft.com/en-us/download/details.aspx?id=17657") EndIf EndIf EndFunc ;==>_RoboKup Func _ShadowCopyOFFeClean() ;RunWait(@ComSpec & ' /c vssadmin delete shadows /shadow={' & $sLShadowID & '} /quiet', '', @SW_HIDE) ;ConsoleWrite( ' vssadmin delete shadows /shadow={' & $sGIdRig & '} /quiet');, '', @SW_HIDE) Run(@ComSpec & ' /k ' & @SystemDir & '\vssadmin.exe delete shadows /shadow={' & $sGIdRig & '} /quiet ') ;, '', @SW_HIDE) ;ConsoleWrite ( ' vssadmin delete shadows /shadow={' & $sLShadowID & '} /quiet') Sleep(300) _WinAPI_RemoveDirectory("C:\Temp\freezer_shadowcopy") EndFunc ;==>_ShadowCopyOFFeClean Func _ShadowCopyON() If @OSVersion = "WIN_XP" Then Local $iLRimanda = MsgBox(4, "Info", "Sarebbe l'ora di cambiare windows XP,detto questo sto per fare il backup, lo lancio?? ", 15) If $iLRimanda = 6 Then _Kill_Prog() ElseIf $iLRimanda = 7 Then MsgBox(0, 'Info', 'ok rilanciami a mano se vuoi backuppare, ciao') Exit Else _Kill_Prog() EndIf Else ;Local $iFileExists = FileExists(@SystemDir & "\WindowsPowerShell") ;If $iFileExists Then RunWait(@ComSpec & ' /c wmic shadowcopy call create Volume=C:\ > C:\temp\ShadowID.txt', '', @SW_HIDE) ;RunWait(@ComSpec & ' /k wmic shadowcopy call create Volume=C:\ > C:\temp\ShadowID.txt');, '', @SW_HIDE) ;Local $avav=_True_ReadFile("C:\temp\ShadowID.txt", 0) Local $sLShadowResult = _True_ReadFile("c:\temp\ShadowID.txt", 0) Local $aLDirtyShadow = StringSplit($sLShadowResult, '"') $sGIdRig = _StringTrimLefTeRight($aLDirtyShadow[2], '1', '1') RunWait(@ComSpec & ' /c vssadmin list shadows > C:\temp\ShadowList.txt', '', @SW_HIDE) Local $aLShadowListT = FileReadToArray("c:\temp\ShadowList.txt") Local $sLPathVolume For $i = 0 To UBound($aLShadowListT) - 1 Local $iPosition = StringInStr($aLShadowListT[$i], $sGIdRig) If $iPosition <> 0 Then $sLPathVolume = $aLShadowListT[($i + 2)] EndIf Next Local $sLShadowCopyVolume = _StringTrimLefTeRight($sLPathVolume, 29, 0) RunWait(@ComSpec & ' /c mklink /d c:\temp\freezer_shadowcopy ' & $sLShadowCopyVolume & '\', '', @SW_HIDE) ConsoleWrite(' /k mklink /d c:\temp\freezer_shadowcopy ' & $sLShadowCopyVolume & '\') ;RunWait(@ComSpec & ' /k mklink /d c:\temp\freezer_shadowcopy ' & $sLShadowCopyVolume & '\');, '', @SW_HIDE) EndIf ;Else ; MsgBox($MB_SYSTEMMODAL, "", "Windows Powershell non esiste devi scaricarlo" & @CRLF & "FileExist returned: " & $iFileExists) ; ShellExecute("https://www.microsoft.com/it-IT/download/confirmation.aspx?id=16818") ; powershell download for windows xp ;EndIf EndFunc ;==>_ShadowCopyON Func _Kill_Prog() Local $aLSource = FileReadToArray(@ScriptDir & "\KillProg.txt") ;_ArrayDisplay($aLSource) For $i = 0 To UBound($aLSource) - 1 ProcessClose($aLSource[$i]) Next EndFunc ;==>_Kill_Prog Func _StringTrimLefTeRight($string, $CountLeft = 0, $CountRight = 0) If $CountLeft = Default Then $CountLeft = 0 If $CountRight = Default Then $CountRight = 0 Local $sLIdLeft = StringTrimLeft($string, $CountLeft) Local $sLIdRig = StringTrimRight($sLIdLeft, $CountRight) Return $sLIdRig EndFunc ;==>_StringTrimLefTeRight Func _3FolderMaximum($path) Local $FileList = _FileListToArray($path, "*.*", 2) _ArrayDisplay($FileList) If @error = 1 Then ;MsgBox(0, "", "No Folders Found.") ;Exit Else If IsArray($FileList) Then If ($FileList[0]) = 3 Then Local $sLFolderPathErase = _FindOldestFolder($path) DirRemove($path & "\" & $sLFolderPathErase, 1) EndIf EndIf EndIf EndFunc ;==>_3FolderMaximum Func _FindOldestFolder($path, $old_new = 0) If $old_new = Default Then $old_new = 0 Local $FileList = _FileListToArray($path, "*.*", 2) If @error = 1 Then MsgBox(0, "", "No Folders Found.") Exit EndIf Local $aLDateDiff[($FileList[0] + 1)] For $i = 1 To UBound($FileList) - 1 Local $aDateFolder = FileGetTime($path & "\" & $FileList[$i], 1, 0) If @error Then Return 0 Else Local $dLOldDate = ($aDateFolder[0] & "/" & $aDateFolder[1] & "/" & $aDateFolder[2] & " " & $aDateFolder[3] & ":" & $aDateFolder[4] & ":" & $aDateFolder[5]) $aLDateDiff[$i] = _DateDiff("s", $dLOldDate, _NowCalc()) EndIf Next If $old_new = 0 Then Return $FileList[_ArrayMaxIndex($aLDateDiff)] Else Return $FileList[_ArrayMinIndex($aLDateDiff)] EndIf EndFunc ;==>_FindOldestFolder Func _Controllo_esistenza_Sorce_Dest($Sorce, $Dest) Local $iFileExists = FileExists($Sorce) Local $iFileExistd = FileExists($Dest) If $iFileExists = 0 Or $iFileExistd = 0 Then MsgBox($MB_SYSTEMMODAL, "", "Manca il file destinazioni o sorgente controlla o chiama stefano 3356963030" & @CRLF & "FileExist returned: " & $iFileExists) Return 0 Else Return 1 EndIf EndFunc ;==>_Controllo_esistenza_Sorce_Dest Func _True_ReadFile($sFilePath, $attribute) Local $hFileOpen = FileOpen($sFilePath, $attribute) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.") Return False EndIf Local $sFileRead = FileRead($hFileOpen) FileClose($hFileOpen) Return $sFileRead EndFunc ;==>_True_ReadFile thnkz
  3. Why can I compile my project on one pc but not another?!

    It seems like a combination of not recognising global variables I declare on the Main.au3, not recognising the functions I've included in the Navigation.au3 and not recognising stuff like AutoItSetOption('SendKey', 10)
  4. Why can I compile my project on one pc but not another?!

    And here's the compiler errors >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\EliteAutomation\Framework\TestMain.au3" /UserParams +>09:50:38 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0 Keyboard:00000809 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0809) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\EliteAutomation\Framework\TestMain.au3 "C:\EliteAutomation\Framework\Tests\TEST2_Add_A_Matter.au3"(74,29) : warning: $hFilehandle: possibly used before declaration. FileWrite($hFilehandle, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\TEST2_Add_A_Matter.au3"(86,25) : warning: $EliteWindow: possibly used before declaration. WinActivate($EliteWindow) ~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Test4_Click_GeneralInfo2_And_Verify_Against_An_existing_Matter.au3"(34,8) : error: syntax error ElseIf Then ~~~~~~~^ "C:\EliteAutomation\Framework\Tests\TEST6_Add_Time_To_A_Matter.au3"(1,10) : error: can't open include file "C:\EliteAutomation\Navigation\BillingManager\Time\Navigation_BillingManager_Time.au3". #include "C:\EliteAutomation\Navigation\BillingManager\Time\Navigation_BillingManager_Time.au3" ~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\TEST6_Add_Time_To_A_Matter.au3"(2,10) : error: can't open include file "C:\EliteAutomation\Navigation\BillingManager\Time\TimeEntryWindow\Navigation_Time_Entry_Window.au3". #include "C:\EliteAutomation\Navigation\BillingManager\Time\TimeEntryWindow\Navigation_Time_Entry_Window.au3" ~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Test7_Add_A_TimeKeeper.au3"(54,20) : warning: $DateBarPassed: possibly used before declaration. Send($DateBarPassed) ~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Test9_Create_A_Voucher.au3"(13,15) : warning: $VendorID: possibly used before declaration. Send($VendorID) ~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\TestMain.au3"(40,30) : error: AutoItSetOption() called with illegal argument 1: "SendKey". AutoItSetOption('SendKey', 10) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Test7_Add_A_TimeKeeper.au3"(54,20) : error: $DateBarPassed: undeclared global variable. Send($DateBarPassed) ~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Test9_Create_A_Voucher.au3"(13,15) : error: $VendorID: undeclared global variable. Send($VendorID) ~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\TEST6_Add_Time_To_A_Matter.au3"(11,39) : error: Navigation_Click_Billing_Manager_Time(): undefined function. Navigation_Click_Billing_Manager_Time() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\TEST6_Add_Time_To_A_Matter.au3"(12,49) : error: Navigation_Click_Billing_Manager_Time_TimeEntry(): undefined function. Navigation_Click_Billing_Manager_Time_TimeEntry() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\TEST6_Add_Time_To_A_Matter.au3"(43,70) : error: Navigation_Click_Billing_Manager_Time_TimeEntry_Tickbox_For_Timecard(): undefined function. Navigation_Click_Billing_Manager_Time_TimeEntry_Tickbox_For_Timecard() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\TEST6_Add_Time_To_A_Matter.au3"(44,65) : error: Navigation_Click_Billing_Manager_Time_TimeEntry_Action_Dropdown(): undefined function. Navigation_Click_Billing_Manager_Time_TimeEntry_Action_Dropdown() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Test7_Add_A_TimeKeeper.au3"(64,77) : error: Navigation_Click_BillingManager_MaterFiles_Timekeeper_AccountingInformation(): undefined function. Navigation_Click_BillingManager_MaterFiles_Timekeeper_AccountingInformation() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Test7_Add_A_TimeKeeper.au3"(66,91) : error: Navigation_Click_BillingManager_MaterFiles_Timekeeper_AccountingInformation_EffectiveDate(): undefined function. Navigation_Click_BillingManager_MaterFiles_Timekeeper_AccountingInformation_EffectiveDate() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Test7_Add_A_TimeKeeper.au3"(71,90) : error: Navigation_Click_BillingManager_MaterFiles_Timekeeper_AccountingInformation_StandardRate(): undefined function. Navigation_Click_BillingManager_MaterFiles_Timekeeper_AccountingInformation_StandardRate() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Test7_Add_A_TimeKeeper.au3"(76,61) : error: Navigation_Click_BillingManager_MaterFiles_Timekeeper_Rates(): undefined function. Navigation_Click_BillingManager_MaterFiles_Timekeeper_Rates() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Finalise_Time_On_A_Matter.au3"(14,62) : error: Navigation_TabAndTickCheckBox_Billing_Manager_Time_TimeEntry(): undefined function. Navigation_TabAndTickCheckBox_Billing_Manager_Time_TimeEntry() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "C:\EliteAutomation\Framework\Tests\Finalise_Time_On_A_Matter.au3"(70,76) : error: Navigation_Tab_Exit_Timecard_And_Timecard_Adjustment_Group_Finalise_Cancel(): undefined function. Navigation_Tab_Exit_Timecard_And_Timecard_Adjustment_Group_Finalise_Cancel() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\EliteAutomation\Framework\TestMain.au3 - 16 error(s), 4 warning(s) !>09:50:39 AU3Check ended. Press F4 to jump to next error.rc:2 +>09:50:39 AutoIt3Wrapper Finished. >Exit code: 2 Time: 1.106
  5. Why can I compile my project on one pc but not another?!

    Now here's the Main file (I have about 20 headers in this project) ; Test includes #include "C:\EliteAutomation\Framework\Tests\TEST2_Add_A_Matter.au3" #include "C:\EliteAutomation\Framework\Tests\Test3_Search_For_A_Matter_And_Verfiy_The_Description_Box.au3" #include "C:\EliteAutomation\Framework\Tests\Test4_Click_GeneralInfo2_And_Verify_Against_An_existing_Matter.au3" #include "C:\EliteAutomation\Framework\Tests\Test5_Verify_Billing2_Tab.au3" #include "C:\EliteAutomation\Framework\Tests\TEST6_Add_Time_To_A_Matter.au3" #include "C:\EliteAutomation\Framework\Tests\Test7_Add_A_TimeKeeper.au3" #include "C:\EliteAutomation\Framework\Tests\Test8_Add_A_Client.au3" #include "C:\EliteAutomation\Framework\Tests\Test9_Create_A_Voucher.au3" #include "C:\EliteAutomation\Framework\Tests\Finalise_Time_On_A_Matter.au3" ;Navigation Includes #include "C:\EliteAutomation\Framework\Navigation\Navigation.au3" #include "C:\EliteAutomation\Framework\Navigation\BillingManager\MasterFiles\Navigation_Client.au3" #include "C:\EliteAutomation\Framework\Navigation\BillingManager\MasterFiles\Navigation_Timekeeper.au3" #include "C:\EliteAutomation\Framework\Navigation\Navigation_Accounts_Payable.au3" ;Page functions #include "C:\EliteAutomation\Framework\PageFunctions\PageFunctions_BillingManagerMaster.au3" ;Handle Elite functions #include "C:\EliteAutomation\Framework\HandleEliteCrashFunction\StartEliteAsAdmin.au3" ;AutoIT includes #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> $TestCount =1 $RandomClientNumber = 45 ;/******************************************************/ ;/*****************Main Program*************************/ ;/******************************************************/ AutoItSetOption('MouseCoordMode', 0) AutoItSetOption('SendKey', 10) Sleep(300) Global $EliteWindow = "Elite Enterprise 3.11" ; create a variable to point at different versions of Elite WinActivate($EliteWindow) ; Focus Elite window Global $sFileName = "C:\EliteAutomation\TestResults.txt" ; Open file - deleting any existing content Global $hFilehandle = FileOpen($sFileName, $FO_OVERWRITE) ;/************ Working Tests ******************/ Test8_Add_A_Client("TestClient5" + Random(100,10000,1) + "", "Bread Test Client", "Redacted", "Redacted", "Redacted", "Redacted", "Redacted", "01/01/2018", "01/01/2025","10", "ZZZ", "Redacted", "Redacted", "Redacted", "Redacted", "04", "N" ) Exit
  6. log4a - A logging UDF

    On the Point what i was confused for Thanks For This example Will Use It!
  7. Why can I compile my project on one pc but not another?!

    Here's one of the header files ;/******************************************************************************************************/ ;/*TEST2_Add_A_Matter******/ ;/******************************************************************************************************/ $TestCount =1 Func Test2_Add_A_Matter($ClientNumber,$MatterNumber) While 1 Local $ActiveTitle = WinGetTitle("[ACTIVE]") if StringInStr($ActiveTitle, "Not Responding") then ;Wait 10 seconds before killing the application Sleep(10000) if StringInStr($ActiveTitle, "Not Responding") then ;restart elite ProcessClose("Enterprise.exe") Else EndIf Else Local $TestResult = False WinActivate("Elite Enterprise 3.11") ;/****** Click on Billing Manager/MasterFiles/Matter**/ Navigation_Click_Billing_Manager() Navigation_Click_BillingManager_MasterFiles() Navigation_Click_BillingManager_MasterFiles_Matter() Sleep(10000) WinWait("[CLASS:SysTreeView32]", "", 10) Navigation_Click_BillingManager_MasterFiles_Matter_MatterField() Sleep(10000) WinWait("[CLASS:SysTreeView32]", "", 10) Send($ClientNumber) Sleep(2000) SEND("{TAB}") Sleep(2000) SEND("{TAB}") Sleep(2000) SEND($MatterNumber) Sleep(2000) SEND("{TAB}") Local $Success = WinWait("[CLASS:Static2]", "", 10) Sleep(3000) ; Retrieve the text of the Description box on the Matter/General Info 1 page ;Local $NewMatterNumber = ControlGetText($hWnd, "", "ThunderRT6TextBox87") ControlClick("", "", "[CLASS:ABSDActiveBarDockWND; INSTANCE:1]", "Left", 1, 78, 39) SEND("^s") WinWait("[CLASS:Static2]", "", 10) Sleep(3000) ; Wait for Window that confirms Matter was successfully saved Local $hWnd = WinWait("Elite Enterprise Matter", "", 10) ;obtain the text in that window which should be "Successfully Saved Matter MATTERNUMBER" Local $RecordSaveSuccess = ControlGetText($hWnd, "", "Static2") WinWaitActive("Elite Enterprise Matter") sleep(500) ControlClick("Elite Enterprise Matter", "", "[CLASS:Button; INSTANCE:1;]") ;click ok Navigation_Click_OK_To_Saved_Matter() ; click ok WinClose ( "Eliter Enterprise Matter") ; close window ;Check inside the string pulled from the Elite Enterprise Matter window to see if it contains Successfully saved ;If it does : pass test and output to a text file if StringInStr($RecordSaveSuccess, "Successfully saved") then MsgBox($MB_SYSTEMMODAL, "Test" & $TestCount & " Result", "Test Passed, Matter Saved" & $RecordSaveSuccess, 4) FileWrite($hFilehandle, @CRLF & "Test" & $TestCount & " Create a new matter using " & $MatterNumber & "as a model matter Ensure matter saves " & $RecordSaveSuccess) FileWrite($hFilehandle, @CRLF & "Test" & $TestCount & " Create a new matter using " & $MatterNumber & "as a model matter Ensure Matter has incremented Test Passed") Else MsgBox($MB_SYSTEMMODAL, "Test" + $TestCount & " Result", "Test Failed", 4) FileWrite($hFilehandle, @CRLF & "Test" & $TestCount & " Create a new matter using " & $MatterNumber & "as a model matter Ensure matter saves Test Failed") FileWrite($hFilehandle, @CRLF & "Test" & $TestCount & " Create a new matter using " & $MatterNumber & "as a model matter Ensure Matter has incremented Test Failed") EndIf Sleep(5000) WinActivate($EliteWindow) Navigation_Click_BillingManager_MasterFiles() Navigation_Click_Billing_Manager() EndIf ExitLoop WEnd EndFunc
  8. AutoItObject UDF

    It's always a good idea to post all error messages you get
  9. AutoItObject UDF

    I have the following object with a property that will store an array. This script work as I expected when I call Add method but crash when I call Destroy method. Functions __add and __destroy have a very similar code I obviously I can't see where the problem is. Even if I comment the line where I redimension the array or if I create a new array when I call Destroy method the script will crash. Some ideas why? #include <AutoItObject.au3> #include <Array.au3> _AutoItObject_Startup() $oTest = Test() $oTest.Add('Test1') $aObjects = $oTest.Objects _ArrayDisplay($aObjects) $oTest.Add('Test2') $aObjects = $oTest.Objects _ArrayDisplay($aObjects) $oTest.Destroy Func Test() Local $aObjects[1] $oTest = _AutoItObject_Class() With $oTest .AddMethod('Destroy','__destory') .AddMethod('Add','__add') .AddProperty('Objects', $ELSCOPE_PUBLIC, $aObjects) EndWith Return $oTest.Object EndFunc Func __add($oThis, $Name) Local $aObjects = $oThis.Objects _ArrayAdd($aObjects,$Name) $oThis.Objects = $aObjects EndFunc Func __destroy($oThis) Local $aObjects = $oThis.Objects ReDim $aObjects[1] $oThis.Objects = $aObjects EndFunc
  10. Today
  11. Good thing I work Graveyard Shift and have 8 hrs to putz around with this and also add Jquery to my repertoire. Once I figure out how to get it to focus on the frame and all that jazz.
  12. This reproducer script works fine for Excel 2016: #include <Excel.au3> ; String 263 characters without spaces, 324 characters including spaces $sString = "This string contains more than 255 characters. I do not know why this is necessary. Maybe it is just to test how Excel handles very long strings when writing to a cell by using function _Excel_RangeWrite. As the string is still too short I will add a few more words. Now the string is long enough so I will stop writing now." $oExcel = _Excel_Open() $oWorkbook = _Excel_BookNew($oExcel) $iResult = _Excel_RangeWrite($oWorkbook, Default, $sString) If @error Then MsgBox(0, "Range Write Error", "@error = " & @error & ", @extended = " & @extended)
  13. Check / Uncheck Menuitems

    Keep in mind, that case statement works because the control IDs are contiguous. If they were not created one after another then that case statement wouldn't work.
  14. key press sequence not working

    Problem solve, I use AU3Record. :)))))
  15. I told you - you need to use _IEFrameGetCollection before your code. Check it out , there is an example. You have 5 frames and need to get the correct frame first. For the Java - onclick="clearSIFields(formx, this, 'fieldsinumber', 12)" this is the Java function that is called , but it will be complicated for you to use it. Go with the frames example.
  16. key press sequence not working

    Local $hWnd = WinGetHandle("9U-34801 - Liaison UTS Terminal Emulator") ;Local $hWnd = WinGetHandle("Untitled - Notepad") If @error Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when trying to retrieve the window handle of Notepad.") Exit EndIf ; Display the handle of the Notepad window. ; MsgBox($MB_SYSTEMMODAL, "", $hWnd) WinActivate($hWnd) SendKeepActive($hWnd) WinWaitActive($hWnd) Sleep(500) Opt("WinTitleMatchMode", 4) $hMain = _GUICtrlMenu_GetMenu($hWnd) $t1 = _GUICtrlMenu_GetItemText($hMain, 0) $hsub = _GUICtrlMenu_GetItemSubMenu($hMain, 0) $t2 = _GUICtrlMenu_GetItemText($hsub, 6) ;if WinMenuSelectItem($hWnd, "", "&File", "Pla&yback Script...") then if WinMenuSelectItem($hWnd, "", $t1, $t2) then MsgBox($MB_SYSTEMMODAL, "", "WinMenuSelectItem: Successfull ") Else MsgBox($MB_SYSTEMMODAL, "","WinMenuSelectItem: failed" ) EndIf ;WinMenuSelectItem($hMain, "", "&File", "Pla&yback Script...") MsgBox($MB_SYSTEMMODAL, "", $t1) MsgBox($MB_SYSTEMMODAL, "", $t2) I try to use menu. Both $t1 and $t2 return correct item. WinMenuSelectItem return successful. And again nothing happen in my application :((((
  17. Check / Uncheck Menuitems

    Thanks @spudw2k and @Malkey! Honestly i'd rather not using checkboxes (they need to be fitted in MainGui or another Gui. And I found so interesting that didn't know I could cycle trough them in Case statement. In this way I will populate a ListView containing only "checked" menuitems. I still need to write this code but I'll do that today, thanks again, Marco
  18. Unable to loop

    If you want $sSrcFile to be deleted then after wend you need something like this... ;;;WEND If FileGetSize($sSrcBat) = 0 Then FileDelete($sSrcBat) Check that size is 0 first just in case it got here through an error...
  19. Unable to loop

    Are you expecting it to delete $sSrcBat when it is empty? I verified it eats all lines in the $sSrcBat it leaves an empty file read 0 bytes
  20. Unable to loop

    it still leaves out a blank line on the tranf.bat....after _FileWriteToLine($sSrcBat, $iLine, "", True)
  21. Unable to loop

    I think this is approximately what you are trying for? #include <FileConstants.au3> #include <File.au3> Global $sSrcBat = "C:\Windows\pyth\bat\transf.bat" Global $sDestBat = "C:\Windows\pyth\bat\trans.bat" Global $sLineText Global Const $iLine = 1 ConsoleWrite($sSrcBat & " , Exists: " & FileExists($sSrcBat) & @CRLF) While FileExists($sSrcBat) $sLineText = FileReadLine($sSrcBat, $iLine) If @error <> 0 Then ConsoleWrite("EOF" & @CRLF) ExitLoop ; end of file, nothing to read left, now exit.... Endif MsgBox(0, "Reading main batch", $sLineText) ;Put First line of src into dest FileWrite($sDestBat, $sLineText & @CRLF) ;Remove the First line from src _FileWriteToLine($sSrcBat, $iLine, "", True) Sleep(1000) MsgBox(0, "Executing single batch", FileReadLine($sDestBat, 1), "", "") ShellExecute($sDestBat, "", "", "") Sleep(1000) FileDelete($sDestBat) WEnd
  22. Unable to loop

    Loop isnt working....it leaves a blank line instead of getting below lines pushed to line 1.... Global $newbatch = ("C:\Windows\pyth\bat\trans.bat") While 1 Global $readfile = FileOpen("C:\Windows\pyth\transf.bat", 0) FileOpen($newbatch, 0) Global $line1 = FileReadLine($readfile, 1) If @error = -1 Then ExitLoop ; end of file, nothing to read left, now exit.... MsgBox(0, "Reading main batch", $line1, "", "") FileWrite($newbatch, $line1 & @CRLF) _FileWriteToLine("C:\Windows\pyth\transf.bat", 1, "", True) FileClose($readfile) Sleep(1000) MsgBox(0, "Executing single batch", FileReadLine($newbatch, 1), "", "") ShellExecute("trans.bat", "", "C:\Windows\pyth\bat\", "") Sleep(1000) FileClose($newbatch) FileDelete($newbatch) WEnd
  23. Hi Water, Thank you for your reply and suggestion. I tried passing the variable to an array, but it still does not work. I am not sure which part is making the error. Below is my script: #include <Excel.au3> #include <Array.au3> Local $sSourcePath = "C:\Users\Desktop\Scripts"     If FileExists($sSourcePath) = 0 Then DirCreate($sSourcePath) Local $sTargetPath = "C:\Users\Desktop\Scripts\"     If FileExists($sTargetPath) = 0 Then DirCreate($sTargetPath) Local $sSourceBook = $sSourcePath & "\Doc 1.xlsx"  Local $oExcel = _Excel_Open()     If @error Then Exit MsgBox(4096, "Excel Error", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oSourceBook = _Excel_BookOpen($oExcel, $sSourceBook)     If @error Then         MsgBox(4096, "Excel Error", "Error opening workbook '" & $sSourceBook & @CRLF & "@error = " & @error & ", @extended = " & @extended)         _Excel_Close($oExcel)         Exit     EndIf Local $oSourceRange, $oTargetBook, $sTargetBook, $x = 1 For $i = 4 To 53     ;Copy & Paste essential 1     $oSourceRange1 = _Excel_RangeRead($oSourceBook,"Doc1","E" & $i)     $sTargetBook = $sTargetPath & "\" & $oSourceRange1 &".xlsx"     $oTargetBook = _Excel_BookOpen($oExcel, $sTargetBook)         If @error Then $oTargetBook = _Excel_BookNew($oExcel)     _Excel_RangeWrite($oTargetBook, Default, $oSourceRange1, "C3")     ;Copy & Paste essential 2     $oSourceRange = _Excel_RangeRead($oSourceBook,"Doc1","D" & $i)     Local $sArray1D [] = [$oSourceRange]     $sTargetBook = $sTargetPath & "\" & $oSourceRange1 &".xlsx"     $oTargetBook = _Excel_BookOpen($oExcel, $sTargetBook)         If @error Then $oTargetBook = _Excel_BookNew($oExcel)     _Excel_RangeWrite($oTargetBook, Default, $oSourceRange, "C4",True)     ;Save and close test case book     _Excel_BookSaveAs($oTargetBook, $sTargetBook, $xlWorkbookDefault)     _Excel_BookClose($oTargetBook)    $x += 1 Next
  24. Why do you have an ampersand in your code above? The first parameter should be a folder, the second parameter the filter. $aFileList = _FileListToArray(@ScriptDir & "\Documents\" & "*.txt") It should be $aFileList = _FileListToArray(@ScriptDir & "\Documents\", "*.txt")
  25. Check / Uncheck Menuitems

    Here is an example that is not "on event" mode. I didn't bother reading or writing to an ini file. #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <Array.au3> Example() Func Example() GUICreate("My GUI menu", 300, 300) Local $sStatus = "Ready" Local $aCurr = [0, 1, 0, 1, 1, 0, 1, 0, 1, 1] ; 0 - checkbox unchecked, 1 - checkbox checked. Global $CB_Curr[UBound($aCurr)] $idFileMenu = GUICtrlCreateMenu("CryptoWatcher") For $i = 0 To UBound($aCurr) - 1 $CB_Curr[$i] = GUICtrlCreateMenuItem("Check " & $i, $idFileMenu) ;ConsoleWrite($CB_Curr[$i] & @CRLF) ; Note the id numbers that were created If $aCurr[$i] Then GUICtrlSetState(-1, $GUI_CHECKED) EndIf Next Local $idBut = GUICtrlCreateButton("Display $aCurr Array", 50, 230, 130, 20) Local $idStatusLabel = GUICtrlCreateLabel($sStatus, 0, 265, 300, 16, BitOR($SS_SIMPLE, $SS_SUNKEN)) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $CB_Curr[0] To $CB_Curr[UBound($aCurr) - 1] $iIndex = $Msg - $CB_Curr[0] ; Finds the index of $CB_Curr array (the Menu Item that was pressed) If BitAND(GUICtrlRead($CB_Curr[$iIndex]), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($CB_Curr[$iIndex], $GUI_UNCHECKED) GUICtrlSetState($idStatusLabel, $GUI_HIDE) $aCurr[$iIndex] = 0 ; Update $aCurr Else GUICtrlSetState($CB_Curr[$iIndex], $GUI_CHECKED) GUICtrlSetState($idStatusLabel, $GUI_SHOW) $aCurr[$iIndex] = 1 ; Update $aCurr EndIf Case $idBut _ArrayDisplay($aCurr) EndSwitch WEnd EndFunc ;==>Example
  26. I am trying to look in a directory with text files stored with materials and find out how many have the searched gas component defined as $searchWord. When I use this the file has to be inside the folder with the documents but once I move it outside the script it give me an error $aFileList = _FileListToArray(@ScriptDir, "*.txt") Error error: syntax error $aFileList = _FileListToArray(@ScriptDir, & ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ #include <File.au3> #include <Array.au3> Global $searchWord = "Inline Valves" ; Find Dimp Item Global $read ; Reads each txt file Readtxt() Func Readtxt() $aFileList = _FileListToArray(@ScriptDir & "\Documents\" & "*.txt") If @error = 1 Then MsgBox(0, "", "No Files\Folders Found.") Exit EndIf Local $aFileStrings[$aFileList[0] + 1][2] = [[$aFileList[0]]] For $i = 1 To $aFileList[0] ; Add file name to [n][0] element $aFileStrings[$i][0] = $aFileList[$i] ; Read file content $sFile = FileRead(@ScriptDir & "\" & $aFileList[$i]) ; Add file content to [n][1] element $aFileStrings[$i][1] = $sFile ConsoleWrite($aFileStrings[$i][1]) $read = FileRead($aFileList[$i]) If StringRegExp($read, $searchWord) Then MsgBox(0, "Dimp Item", "Match") ExitLoop Else ;MsgBox(0, "Dimp Item", "No match") ; Certain documents will not have the same installed components EndIf Next _ArrayDisplay($aFileStrings) EndFunc ;==>Readtxt Adding the directory will enable the @error If @error = 1 Then MsgBox(0, "", "No Files\Folders Found.") Exit EndIf
  27. Check / Uncheck Menuitems

    I made a demo script once that used an INI file to create a checkbox list and saved the states which your post made me think of. I did a quick and dirty tailor to make it work for a menu instead of CheckBox controls; try it out if you please:
  1. Load more activity
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.