Jump to content

damon

Active Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by damon

  1. you are right, I just figured out what i was doing. when i came back to post my update seen your question and that was my fix. thank you.
  2. Hello, You guys helped me years ago to address logging in with a different account than the user. I have sense modified it over the years due to laptops syncing with AD which is why you will see 3 different passwords. So, this script snippet has worked for me in many things i have written but I am all the sudden having an issue getting it to work. I have verified that the password i am using for the local user account is $pass. Verified by doing a run as different user on Chrome and cut and pasted the password out of the script just to make sure i was not fat fingering something. I get a fail back from RunAs every time. Any chance you guys see something i am doing wrong? #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> ;#RequireAdmin If $CmdLine[0] > 0 Then If $CmdLine[1] = "/Install" Then RunUpdate() Exit EndIf ;;Will check users account to determine if admin, if not will Run with admin rights -------------------------------------------------------------- ;;Varables Start Local $user = ".\user" Local $pass = "password1" Local $pass2 = "password2" Local $pass3 = "password3" Local $filetorun = @ScriptFullPath & " /Install" ;;Varables End If IsAdmin () = 0 Then If RunAs ( $user, @CompterName, $pass, $RUN_LOGON_NOPROFILE,$filetorun) = 0 Then ;If RunAs ( $user, @ComputerName, $pass2, 0,$filetorun) = 0 Then ;If RunAs ( $user, @ComputerName, $pass3, 0,$filetorun) = 0 Then ;MsgBox (0,"Installation Error", "This installation was interrupted due to an incorrect Admin Password") ;Exit ;EndIf ;EndIf EndIf Exit Else Run ($filetorun) EndIf Func RunUpdate() MsgBox(0,"worked","worked") EndFunc
  3. @careca Thank you so much for your help. I was over complicating the structure and you helped me to realize that. thank you. I got it going using your suggestion of replacing the Select/Case with If statements. This gave me the ability to test for two expressions which is what i was needing to move through the code. Here is what i did and it works great. If $SplitFile[0] <> $FileNetPropertiesSplit[0] Then;$FileNetPropertiesSplit[0] will give the number of properties in the config file for FileNet, this is used for validation placement FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "File has " & $SplitFile[0] & " '-' Requirement is 12::" & $aFileList[$i]) ElseIf $SplitFile[$ValidationDocumentTitleLocation] <> $ValidationDocumentTitle Then; Checks that Filename = DWRSSD FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "File is not Named Correctly with 'DWRSSD'::" & $aFileList[$i]) ElseIf $ValidationRDALocation <> 999 And $SplitFile[$ValidationRDALocation] <> $ValidationRDA Then ;Checks Validation of RDA number FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "RDA was " & $SplitFile[$ValidationRDALocation] & " should have been " & $ValidationRDA & "::" & $aFileList[$i]) ElseIf $ValidationCountyCodeLocation <> 999 And StringLen($SplitFile[$ValidationCountyCodeLocation]) <> 3 Then FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "File county code must be 3 digits::" & $aFileList[$i]) ElseIf $Validation3Location <> 999 And $SplitFile[$Validation3Location] <> $Validation3 Then FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "Validation is set to '" & $SplitFile[$Validation3Location] & "' Validation should be set to " & $Validation3 & "::" & $aFileList[$i]) ElseIf $Validation4Location <> 999 And $SplitFile[$Validation4Location] <> $Validation4 Then FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "Validation is set to '" & $SplitFile[$Validation4Location] & "' Validation should be set to " & $Validation4 & "::" & $aFileList[$i]) EndIf
  4. The problem is that there may be times where the $validationCountyCodeLocation may be set to 999, so if it is I put an if statement in to set $CaseCountyCheck = 1 <> 1 so that it would set the expression to FALSE in the case and it would proceed to the next case expression. I am probably going about this structure all wrong. What i am trying to accomplish is a filename validation that reads from a config file. I want to add multiple sections to that config so that i can validate different files in different directories. most all that is working, but there may come a time where $validation3 is not needed so i was going to use 999 as basically a NULL in the ini file and when this is read with iniread it would set to a False so the case would be skipped and the next case would be evaluated. What i am trying to do and not sure this is even possible is set the $CaseCountyCheck = expression $CaseCountyCheck = StringLen($SplitFile[$ValidationCountyCodeLocation]) <> 3 select Case $CaseCountyCheck     MsgBox(64, "CaseCheck", "This case validated as county code not 3 digits") Endselect Depending on the Value of $ValidationCountyCodeLocation depends if i need the case to evaluate it. -- This is really my ultimate goal, if the value is blank when i read the ini file then i do not want it evaluated but if it has a value then i need it to be evaluated.
  5. @careca I thought i had copied all the code, may fault. the problem section is what did not even copy. sorry. I did forget i divided the ini file into two different files so that I have a system ini and a user ini. This line you referred to above and these others is the problem i am having. I realize i am trying to call $SplitFile array before it has been defined. not trying to call the code but i need it set to a var so i can call it in the Select/Case in Func FileSplitCount(). $CaseCountyCheck = 'StringLen($SplitFile[$ValidationCountyCodeLocation]) <> 3' ; Checks for 3 digit County Code $CaseRDALocationCheck = '$SplitFile[$ValidationRDALocation] <> $ValidationRDA' ; Checks for 4 Digit RDA $CaseValidation3LocationCheck = '$SplitFile[$Validation3Location] <> $Validation3' $CaseValidation3LocationCheck = '$SplitFile[$Validation4Location] <> $Validation4' Another thing to note. In the Config.ini there are 3 directories. you will need to have 3 folders created for the script to run and be pointed to. Using just a blank text file and name it DWRSSD-37087-95-026.%-064.00-Tatum Family %-%-1230 Academy Rd-%-PERM-TRUE-2403.pdf Make sure this file is in the Pending folder. The script should move it to the review folder when ran and the error log file should say it was moved because the file failed from not being a 3 digit county code. This file will fail on the 95, it should be 095. The problem i am getting is with the 2403 it fails even though the ini file value ValidationRDA = 2403 #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=C:\Users\bg01152\Desktop\Split Program\Split no Upload\Split-NoUpload.Exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: Damon Pence Script Function: Files is used for File Pickup process. This file has (2) ini files used for configurations. SysConfig - used for primary functions of program Config - Used to configure path and other options for each division #ce ---------------------------------------------------------------------------- #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> ;------------Global Vars --------------------- Global $SplitFile, $aFileList, $FileLog, $dFolder, $sFolder, $cFolder, $ConfigFile, $t Global $ValidationDocumentTitle, $ValidationDocumentTitleLocation, $ValidationCountyCodeLocation, $ValidationRDA Global $ValidationRDALocation, $Validation3, $Validation3Location, $Validation4, $Validation4Location, $FileNetPropertiesSplit Global $CaseCountyCheck, $CaseRDALocationCheck, $CaseValidation3LocationCheck, $CaseValidation4LocationCheck, $SplitFile ;;--------------------------------Check and Read Config files-------------------------------- $SysConfigFile = @ScriptDir & "\SysConfig.ini" ;----------------PreCheck for Config File-------------- If FileExists ($SysConfigFile) <> 1 Then Exit EndIf ;----------------End PreCheck-------------------------- $FileNetEXE = @ScriptDir & "\" & IniRead ($SysConfigFile, "FileNetUploader","FileName","") $delimiter = IniRead ($SysConfigFile, "FileInformation", "Delimiter","") $Filter = IniRead ($SysConfigFile, "FileInformation", "Filter", "") $ConfigFile = @ScriptDir & "\Config.ini" ;----------------PreCheck for Config File-------------- If FileExists ($ConfigFile) <> 1 Then Exit EndIf ;----------------End PreCheck-------------------------- ;;-------------------------------------------------------------------------------------------- $Sections = IniReadSectionNames ($ConfigFile) ;MsgBox (0,"test", $Sections[0] & @CRLF & $Sections[1] & @CRLF & $Sections[2] & @CRLF & $Sections[3] & @CRLF & $Sections[4]);TESTING ONLY - DELETE WHEN DONE $p = 0 Do $t = 0 ;used for precheck $p = $p + 1 ConfigDefineVars($Sections[$p]) ;MsgBox(0,"ConfigDefineVars", $sFolder & @CRLF & $dFolder & @CRLF & $cFolder);TESTING ONLY - DELETE WHEN DONE PreCheck($dFolder, $sFolder, $cFolder) ;Runs a Pre-check to make sure folder structure exists before running the program If $t = 0 Then ;MsgBox(0,"PreCheck Run", "Running next functions");TESTING ONLY - DELETE WHEN DONE ListArray($sFolder, $Filter) ;Puts File Names in String Array ;_ArrayDisplay ($aFileList, $Sections[$p]) If $t = 0 Then FileSplitCount($dFolder, $aFileList) ;Takes filename String Array and splits by $delimiter ;MsgBox(0,"PreCheck Run2", "Running split function");TESTING ONLY - DELETE WHEN DONE Else ;MsgBox(0,"PreCheck Run2", "Skipping split function");TESTING ONLY - DELETE WHEN DONE EndIf Else ;MsgBox(0,"PreCheck Run", "Skipping next functions");TESTING ONLY - DELETE WHEN DONE EndIf Until $p = $Sections[0] ExitScript() ;Exit script Function Func ConfigDefineVars($SectionsNum);Defines Variables from config file Sections $sFolder = IniRead ($ConfigFile, $SectionsNum, "pendingFolder","") ;Pending Folder, Folder that is awaiting the process $dFolder = IniRead ($ConfigFile, $SectionsNum, "reviewFolder","") ;Review Folder, Files that did not pass validation check and division needs to review $cFolder = IniRead ($ConfigFile, $SectionsNum, "completedFolder","") ;Completed Folder, Once process is completed this would be location files get moved to $FileNetProperties = IniRead ($ConfigFile, $SectionsNum, "FileNetProperties","") $FileNetPropertiesSplit = StringSplit ($FileNetProperties,",") $ValidationDocumentTitle = IniRead ($ConfigFile, $SectionsNum, "ValidationDocumentTitle","") $ValidationDocumentTitleLocation = IniRead ($ConfigFile, $SectionsNum, "ValidationDocumentTitleLocation","") $ValidationCountyCodeLocation = IniRead ($ConfigFile, $SectionsNum, "ValidationCountyCodeLocation","") $ValidationRDA = IniRead ($ConfigFile, $SectionsNum, "ValidationRDA","") $ValidationRDALocation = IniRead ($ConfigFile, $SectionsNum, "ValidationRDALocation","") $Validation3 = IniRead ($ConfigFile, $SectionsNum, "Validation3","") $Validation3Location = IniRead ($ConfigFile, $SectionsNum, "Validation3Location","") $Validation4 = IniRead ($ConfigFile, $SectionsNum, "Validation4","") $Validation4Location = IniRead ($ConfigFile, $SectionsNum, "Validation4Location","") If $ValidationCountyCodeLocation = 999 Then $CaseCountyCheck = 1 <> 1 Else ;MsgBox (0,"test of county code", "location = " &$ValidationCountyCodeLocation) $CaseCountyCheck = 'StringLen($SplitFile[$ValidationCountyCodeLocation]) <> 3' ; Checks for 3 digit County Code EndIf If $ValidationRDALocation = 999 Then $CaseRDALocationCheck = 1 <> 1 Else $CaseRDALocationCheck = '$SplitFile[$ValidationRDALocation] <> $ValidationRDA' ; Checks for 4 Digit RDA EndIf If $Validation3Location = 999 Then $CaseValidation3LocationCheck = 1 <> 1 Else $CaseValidation3LocationCheck = '$SplitFile[$Validation3Location] <> $Validation3' ;Checks Validation3 EndIf If $Validation4Location = 999 Then $CaseValidation4LocationCheck = 1 <> 1 Else $CaseValidation3LocationCheck = '$SplitFile[$Validation4Location] <> $Validation4' ; Checks Validation4 EndIf EndFunc Func ValidationCheck ($check1) $blank = StringLen ($check1) If $check1 Then EndIf EndFunc Func PreCheck($dFolder, $sFolder, $cFolder) ;----------------PreCheck for Destination Folder-------------- If FileExists ($dFolder) <> 1 Then $t = 1 Return Else $FileLog = FileOpen($dFolder & "\FileLog.log", 1) EndIf ;----------------End PreCheck-------------------------- ;----------------PreCheck for Source Folder-------------- If FileExists ($sFolder) <> 1 Then _FileWriteLog($FileLog, "Path to Pending Folder -- " & $sFolder & " -- does not exist") $t = 1 Return EndIf ;----------------End PreCheck-------------------------- ;----------------PreCheck for Completed Folder--------- If FileExists ($cFolder) <> 1 Then _FileWriteLog($FileLog, "Path to Completed Folder -- " & $cFolder & " -- does not exist") $t = 1 Return EndIf ;----------------End PreCheck-------------------------- EndFunc Func ListArray($sFolder, $Filter) $aFileList = _FileListToArray($sFolder, $Filter, 1) ;Create an array of files from the source folder filtering by filetype ;in the config.ini files for the specified section If @error = 1 Then ;MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") _FileWriteLog($FileLog, "Path to File(s) is Invalid") $t = 1 Return EndIf If @error = 4 Then ;MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") _FileWriteLog($FileLog, "No File(s) were found, exiting.") $t = 1 Return EndIf EndFunc ;==>ListArray Func FileSplitCount($dFolder, $aFileList) ;$FileLog = FileOpen($dFolder & "\FileLog.log", 1) $i = 0 $y = $aFileList[0] Do $i = $i + 1 $SplitFilename = StringTrimRight ($aFileList[$i], 4);strips .pdf from file before creating array $SplitFile = StringSplit($SplitFilename, $delimiter);Splits the filename in to array in order to perform validation on each part Select;Conditions for FileName to match so that they will upload correctly into FileNet Case $SplitFile[0] <> $FileNetPropertiesSplit[0] ;$FileNetPropertiesSplit[0] will give the number of properties in the config file for FileNet, this is used for validation placement FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "File has " & $SplitFile[0] & " '-' Requirement is 12::" & $aFileList[$i]) Case $SplitFile[$ValidationDocumentTitleLocation] <> $ValidationDocumentTitle ; Checks that Filename = DWRSSD FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "File is not Named Correctly with 'DWRSSD'::" & $aFileList[$i]) Case $CaseRDALocationCheck FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "RDA was " & $SplitFile[$ValidationRDALocation] & " should have been " & $ValidationRDA & "::" & $aFileList[$i]) Case $CaseCountyCheck FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "File county code must be 3 digits::" & $aFileList[$i]) Case $CaseValidation3LocationCheck FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "Validation is set to '" & $SplitFile[$Validation3Location] & "' Validation should be set to " & $Validation3 & "::" & $aFileList[$i]) Case $CaseValidation4LocationCheck FileMove($sFolder & "\" & $aFileList[$i], $dFolder & "\") _FileWriteLog($FileLog, "Validation is set to '" & $SplitFile[$Validation4Location] & "' Validation should be set to " & $Validation4 & "::" & $aFileList[$i]) EndSelect Until $i = $y EndFunc ;==>FileSplitCount Func CopyCompleted() EndFunc Func ExitScript() _FileWriteLog($FileLog, "Complete.") FileClose ($FileLog) EndFunc ;==>ExitScript thanks, Damon SysConfig.ini Config.ini
  6. @JLogan3o13 I apologize, I did not think of it that way. I have attached all the code and the Ini File information. Please let me know if I need to add anything else to help understand what is happening. thank you. Guys, I apologize in advance as I did not search for my answer before posting. I just could not figure out a way to search that made since so I decided to go ahead and post my question. Getting to it. Background: this is being used to validate file names before moving to a new location. though i have not included all the code, below is what i am having a problem with. I have an ini file that i am reading values from. Func ConfigDefineVars() -- I read the value of $ValidationRDA and everything is good then I set $CaseRDALocationCheck = '$SplitFile[$ValidationRDALocation]' <> $ValidationRDA the code that will be used in the select case in Func FileSplitCount(). The problem i have is that even though the numbers = each other they are not recognizing as =. This is what i am getting in my log file i create. 2017-12-04 14:09:53 : RDA was 2403 should have been 2403: If I move $SplitFile[$ValidationRDALocation] <> $ValidationRDA to the Case line under the function it works correctly. I think this has to do with my use of ' ' around the '$SplitFile[$ValidationRDALocation]' but i don't know what option i have in Func ConfigDefineVars I am not ready to define $SplitFile. I have tried adding it to my Global Vars at the top of my script but that did not seem to help. There will be more fail this is just the first one in the select case. Any help or ideas would be greatly appreciated. thanks, Damon Example of a filename used. DWRSSD-37087-95-026.%-064.00-Tatum Family %-%-1230 Academy Rd-%-PERM-TRUE-2403.pdf This file will fail on the 95, it should be 095. The problem i am getting is with the 2403 it fails even though the ini file value ValidationRDA = 2403 Ini File: [SSD_FolderPaths] pendingFolder=C:\Users\bg01152\Desktop\SSD Test\pending reviewFolder=C:\Users\bg01152\Desktop\SSD Test\review completedFolder=C:\Users\bg01152\Desktop\SSD Test\Completed FileNetProperties=DocumentTitle,ZipCode,County,MapAndGroupID,ParcelID,PropertyOwner,Subdivision,StreetAddress,LotNumber,DocumentType,Approved,RDANumber ValidationDocumentTitle=DWRSSD ValidationDocumentTitleLocation=1 ValidationCountyCodeLocation=3 ValidationRDA=2403 ValidationRDALocation=12 Validation3=TRUE Validation3Location=11 Validation4=PERM Validation4Location=10 #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> ;------------Global Vars --------------------- Global $SplitFile, $aFileList, $FileLog, $dFolder, $sFolder, $cFolder, $ConfigFile, $t Global $ValidationDocumentTitle, $ValidationDocumentTitleLocation, $ValidationCountyCodeLocation, $ValidationRDA Global $ValidationRDALocation, $Validation3, $Validation3Location, $Validation4, $Validation4Location, $FileNetPropertiesSplit Global $CaseCountyCheck, $CaseRDALocationCheck, $CaseValidation3LocationCheck, $CaseValidation4LocationCheck, $SplitFile ;;--------------------------------Check and Read Config files-------------------------------- $SysConfigFile = @ScriptDir & "\SysConfig.ini" ;----------------PreCheck for Config File-------------- If FileExists ($SysConfigFile) <> 1 Then Exit EndIf ;----------------End PreCheck-------------------------- $FileNetEXE = @ScriptDir & "\" & IniRead ($SysConfigFile, "FileNetUploader","FileName","") $delimiter = IniRead ($SysConfigFile, "FileInformation", "Delimiter","") $Filter = IniRead ($SysConfigFile, "FileInformation", "Filter", "") $ConfigFile = @ScriptDir & "\Config.ini" ;----------------PreCheck for Config File-------------- If FileExists ($ConfigFile) <> 1 Then Exit EndIf ;----------------End PreCheck-------------------------- ;;-------------------------------------------------------------------------------------------- $Sections = IniReadSectionNames ($ConfigFile) ;MsgBox (0,"test", $Sections[0] & @CRLF & $Sections[1] & @CRLF & $Sections[2] & @CRLF & $Sections[3] & @CRLF & $Sections[4]);TESTING ONLY - DELETE WHEN DONE $p = 0 Do $t = 0 ;used for precheck $p = $p + 1 ConfigDefineVars($Sections[$p]) ;MsgBox(0,"ConfigDefineVars", $sFolder & @CRLF & $dFolder & @CRLF & $cFolder);TESTING ONLY - DELETE WHEN DONE PreCheck($dFolder, $sFolder, $cFolder) ;Runs a Pre-check to make sure folder structure exists before running the program If $t = 0 Then ;MsgBox(0,"PreCheck Run", "Running next functions");TESTING ONLY - DELETE WHEN DONE ListArray($sFolder, $Filter) ;Puts File Names in String Array ;_ArrayDisplay ($aFileList, $Sections[$p]) If $t = 0 Then FileSplitCount($dFolder, $aFileList) ;Takes filename String Array and splits by $delimiter ;MsgBox(0,"PreCheck Run2", "Running split function");TESTING ONLY - DELETE WHEN DONE Else ;MsgBox(0,"PreCheck Run2", "Skipping split function");TESTING ONLY - DELETE WHEN DONE EndIf Else ;MsgBox(0,"PreCheck Run", "Skipping next functions");TESTING ONLY - DELETE WHEN DONE EndIf Until $p = $Sections[0] ExitScript() ;Exit script Function Func ConfigDefineVars($SectionsNum);Defines Variables from config file Sections $sFolder = IniRead ($ConfigFile, $SectionsNum, "pendingFolder","") ;Pending Folder, Folder that is awaiting the process $dFolder = IniRead ($ConfigFile, $SectionsNum, "reviewFolder","") ;Review Folder, Files that did not pass validation check and division needs to review $cFolder = IniRead ($ConfigFile, $SectionsNum, "completedFolder","") ;Completed Folder, Once process is completed this would be location files get moved to $FileNetProperties = IniRead ($ConfigFile, $SectionsNum, "FileNetProperties","") $FileNetPropertiesSplit = StringSplit ($FileNetProperties,",") $ValidationDocumentTitle = IniRead ($ConfigFile, $SectionsNum, "ValidationDocumentTitle","") $ValidationDocumentTitleLocation = IniRead ($ConfigFile, $SectionsNum, "ValidationDocumentTitleLocation","") $ValidationCountyCodeLocation = IniRead ($ConfigFile, $SectionsNum, "ValidationCountyCodeLocation","") $ValidationRDA = IniRead ($ConfigFile, $SectionsNum, "ValidationRDA","") $ValidationRDALocation = IniRead ($ConfigFile, $SectionsNum, "ValidationRDALocation","") $Validation3 = IniRead ($ConfigFile, $SectionsNum, "Validation3","") $Validation3Location = IniRead ($ConfigFile, $SectionsNum, "Validation3Location","") $Validation4 = IniRead ($ConfigFile, $SectionsNum, "Validation4","") $Validation4Location = IniRead ($ConfigFile, $SectionsNum, "Validation4Location","") If $ValidationCountyCodeLocation = 999 Then $CaseCountyCheck = 1 <> 1 Else ;MsgBox (0,"test of county code", "location = " &$ValidationCountyCodeLocation) $CaseCountyCheck = StringLen('$SplitFile[$ValidationCountyCodeLocation]') <> 3 ; Checks for 3 digit County Code EndIf If $ValidationRDALocation = 999 Then $CaseRDALocationCheck = 1 <> 1 Else $CaseRDALocationCheck = '$SplitFile[$ValidationRDALocation]' <> $ValidationRDA ; Checks for 4 Digit RDA EndIf If $Validation3Location = 999 Then $CaseValidation3LocationCheck = 1 <> 1 Else $CaseValidation3LocationCheck = '$SplitFile[$Validation3Location]' <> $Validation3 ; Checks that Approved = True EndIf If $Validation4Location = 999 Then $CaseValidation4LocationCheck = 1 <> 1 Else $CaseValidation3LocationCheck = '$SplitFile[$Validation4Location]' <> $Validation4 ; Checks that Document Type = PERM EndIf EndFunc Func ValidationCheck ($check1) $blank = StringLen ($check1) If $check1 Then EndIf EndFunc Func PreCheck($dFolder, $sFolder, $cFolder) ;----------------PreCheck for Destination Folder-------------- If FileExists ($dFolder) <> 1 Then $t = 1 Return Else $FileLog = FileOpen($dFolder & "\FileLog.log", 1) EndIf ;----------------End PreCheck-------------------------- ;----------------PreCheck for Source Folder-------------- If FileExists ($sFolder) <> 1 Then _FileWriteLog($FileLog, "Path to Pending Folder -- " & $sFolder & " -- does not exist") $t = 1 Return EndIf ;----------------End PreCheck-------------------------- ;----------------PreCheck for Completed Folder--------- If FileExists ($cFolder) <> 1 Then _FileWriteLog($FileLog, "Path to Completed Folder -- " & $cFolder & " -- does not exist") $t = 1 Return EndIf ;----------------End PreCheck-------------------------- EndFunc Func ListArray($sFolder, $Filter) $aFileList = _FileListToArray($sFolder, $Filter, 1) ;Create an array of files from the source folder filtering by filetype ;in the config.ini files for the specified section If @error = 1 Then ;MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") _FileWriteLog($FileLog, "Path to File(s) is Invalid") $t = 1 Return EndIf If @error = 4 Then ;MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") _FileWriteLog($FileLog, "No File(s) were found, exiting.") $t = 1 Return EndIf EndFunc ;==>ListArray
  7. I am having an issue with windows 10 and regwrite. when i run my script it acts as though it has updated the registry but when i view the registry it has not updated the keys. I added error checking to the script but it is not showing errors. now if i remove #requireadmin i will get error 1 - unable to open requested key. her is my code. #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Process.au3> ; Declared Variables Global $userName = "user" Global $userPassword = "Ktesting" Global $autologin = "1" Global $notification = "0" Global $balloon = "0" If @OSArch = "X64" Then Global $HKLM = "HKLM64" Else Global $HKLM = "HKLM" EndIf ; Looks for switch on program start If $CmdLine[0] > 0 Then ; looks for switch on startup If $CmdLine[1] = "/boot" Then BootMachine() Else MachineInstallation() EndIf ; Setup Kiosk for first time Func MachineInstallation() #RequireAdmin MsgBox (1, "Installation", "Starting Install") ; Add Program to Run registry Key RegWrite ($HKLM & "\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "DL Kiosk", "REG_SZ", "c:\temp\DL Testing Kiosk\dl testing kiosk.exe /boot") If @error Then MsgBox (1, "error", @error) EndIf ; Add Automatic Logon Registry Key RegWrite ($HKLM & "\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon", "AutoAdminLogon", "REG_SZ", $autologin) If @error Then MsgBox (1, "error", @error) EndIf RegWrite ($HKLM & "\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon", "DefaultUserName", "REG_SZ", $userName) If @error Then MsgBox (1, "error", @error) EndIf RegWrite ($HKLM & "\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon", "DefaultPassword", "REG_SZ", $userPassword) If @error Then MsgBox (1, "error", @error) EndIf ; Pop Ups and Notification Center Registry RegWrite ("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", "REG_SZ", $notification) If @error Then MsgBox (1, "error", @error) EndIf RegWrite ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableBalloonTips", $balloon) If @error Then MsgBox (1, "error", @error) EndIf MsgBox (1, "Installation", "Install completed") EndFunc Exit EDIT: i think i figured out my problem. I was missing the space between Windows and NT. user error, sorry.
  8. Sorry, I was searching trying to find my answer without asking and this was a topic I found. I will remember that for future post. however I did find my answer right after I posted. I use the AutoIt Help all the time and I overlooked the top portion of the remarks. I was trying to use {ALTDOWN}, {ALT} and "T" in many different ways. thank you for your help. Damon
  9. I know that this was from long ago, can you tell me how you were able to send the ALT T. I have tried many things and its not working for me.
  10. you were right, i just found it. Line 74 FileClose($openBinFile) I was using FileClose($binFile) this fixed it. thanks.
  11. below is the entire code, i am getting the same, i know its something in the code that i am missing #include <file.au3> #include <date.au3> #include <Constants.au3> ;;common variables Global $file = @ScriptDir & "\dingservice.log" Global $binFile = @ScriptDir & "\bin.txt" Global $CycleFile = @ScriptDir & "\CycleFile.txt" Global $line Global $outboxID = "000000000" Global $count = 1 ;;sets line count Global $aTemp, $sHour, $sMinute, $sSecond ;;Counts how many lines in the file $lineCount = _FileCountLines($file) $lineCount = $lineCount + 1 ;;Opens file $fileOpen = FileOpen($file, 0) If $fileOpen = -1 Then ;; -1 = Error MsgBox (0, "ERROR", "Unable to open file." & @CRLF & "Exiting Program") Exit EndIf ;;Open Bin file $openBinFile = FileOpen($binFile,2) If $openBinFile = -1 Then ;;-1 = Error MsgBox (0, "ERROR", "Error opening working file" & @CRLF & "Exiting Program" ) Exit EndIf ;;Open Cycle file $openCycleFile = FileOpen($CycleFile,2) If $openCycleFile = -1 Then ;;-1 = Error MsgBox (0, "ERROR", "Error opening working file" & @CRLF & "Exiting Program" ) Exit EndIf ProgressOn("Creating Report","Please Wait.","" ,-1,-1,16) $progressSet = 100 / $lineCount $currentProgress = $progressSet sleep(1000) ;;processes the report Do ;;parse for ERR or INF $lineRead = FileReadLine($file, $count) $stringsplit1 = StringLeft($lineRead,91) $stringsplit2 = StringRight($stringsplit1, 5) If $stringsplit2 = "Sendi" Then FileWriteLine($openBinFile, $lineRead) ;;parse for current 9 digits $outboxID = StringRight($lineRead,9) $countAhead = $count + 1 $lineReadAhead = FileReadLine ($file, $countAhead) ;;Parse for 9 Digit number and compare it to the previous for <> $outboxID2 = StringRight($lineReadAhead, 9) $stringCompare = StringCompare($outboxID2, $outboxID,2) ;; -1 = greater than number before 1 = less than 0 = equal t If $stringCompare = -1 Then CycleTime() ;$binFileRead = FileRead($binFile) FileClose($binFile) FileDelete($binFile) ;$binFileDel = #cs If $binFileDel = 0 Then ;;0 = Error MsgBox (0, "ERROR", "Error Deleting" & $binFile & @CRLF & "Exiting Program" ) Exit EndIf $binFileCreate = _FileCreate($binFile) If $binFileCreate <> 1 Then ;;0 = Error MsgBox (0, "ERROR", "Error Creating" & $binFile & @CRLF & "Exiting Program" ) Exit EndIf #ce FileOpen($binFile,2) ;FileSetPos($binFile,-1,0) EndIf EndIf $currentProgress = $currentProgress + $progressSet ProgressSet($currentProgress, "Lime " & $count & " of " & $lineCount) $count = $count + 1 Until $count = $lineCount FileClose($fileOpen) FileClose($binFile) FileClose($CycleFile) ProgressOff() MsgBox (0, "Complete", "INF or ERR = " & $stringsplit2 & @CRLF & "Line Read " & $lineRead & @CRLF & "split1 = " & $stringsplit1 & @CRLF & "split2 = " & $stringsplit2) Exit Func CycleTime() $cycleCount = _FileCountLines($binFile) $cycleLineRead = FileReadLine ($binFile, 1) $sTime1 = StringLeft($cycleLineRead,19) $sTime1 = StringRight($sTime1, 8) $cycleLineRead2 = FileReadLine ($binFile, $cycleCount) $sTime2 = StringLeft($cycleLineRead2,19) $sTime2 = StringRight($sTime2, 8) $aTemp = StringSplit($sTime1, ":") $iTime1 = _TimeToTicks($aTemp[1], $aTemp[2], $aTemp[3]) $aTemp = StringSplit($sTime2, ":") $iTime2 = _TimeToTicks($aTemp[1], $aTemp[2], $aTemp[3]) _TicksToTime($iTime2-$iTime1, $sHour, $sMinute, $sSecond) FileWriteLine($openCycleFile,"Cycle " & $count & " " & $sHour & ":" & $sMinute & ":" & $sSecond) EndFunc file it scans: dingService.log 2013-08-15 13:20:34,894 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 502500104 2013-08-15 13:20:36,534 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 511100055 2013-08-15 13:20:38,300 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 511200054 2013-08-15 13:20:40,519 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 820300082 2013-08-15 13:20:42,237 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 851100014 2013-08-15 13:20:59,129 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 340200130 2013-08-15 13:20:59,847 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 501200068 2013-08-15 13:21:01,363 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 701500132 2013-08-15 13:21:02,754 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 706100016 2013-08-15 13:21:06,988 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 720200101 2013-08-15 13:21:24,020 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 122200030 2013-08-15 13:21:25,223 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 303200062 2013-08-15 13:21:26,176 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 310100101 2013-08-15 13:21:27,801 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 720100102 2013-08-15 13:21:29,911 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 740300093 2013-08-15 13:21:31,504 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 801400093 2013-08-15 13:21:33,083 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 820200084 2013-08-15 13:21:49,677 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 104100070 2013-08-15 13:21:50,724 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 310100093 2013-08-15 13:21:52,145 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 310200100 2013-08-15 13:21:52,849 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 330100096 2013-08-15 13:21:54,161 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 520200049 2013-08-15 13:21:55,364 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 530100026 2013-08-15 13:21:56,521 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 570100013 2013-08-15 13:21:57,614 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 620100053 2013-08-15 13:22:00,005 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 720200104 2013-08-15 13:22:01,646 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 820300083 2013-08-15 13:22:02,927 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 820400085 2013-08-15 13:22:05,255 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 840200070 2013-08-15 13:22:22,131 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 103100035 2013-08-15 13:22:24,115 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 111100038 2013-08-15 13:22:25,443 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 123200076 2013-08-15 13:22:27,100 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 302100096 2013-08-15 13:22:29,381 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 302400095 2013-08-15 13:22:30,662 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 340300131 2013-08-15 13:22:31,412 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 360200101 2013-08-15 13:22:32,412 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 410200091 2013-08-15 13:22:35,022 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 410300092 2013-08-15 13:22:36,084 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 501100064 2013-08-15 13:22:37,772 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 601100068 2013-08-15 13:22:39,365 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 601200067 2013-08-15 13:22:40,444 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 620200047 2013-08-15 13:22:41,381 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 701100133 2013-08-15 13:22:42,756 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 701100136 2013-08-15 13:22:43,397 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 701300134 2013-08-15 13:22:44,537 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 704100016 2013-08-15 13:22:45,647 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 720400105 2013-08-15 13:22:48,194 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 741200078 2013-08-15 13:23:05,491 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 103100034 2013-08-15 13:23:06,960 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 150100016 2013-08-15 13:23:08,085 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 221200023 2013-08-15 13:23:09,210 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 301300129 2013-08-15 13:23:10,585 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 301300130 2013-08-15 13:23:11,632 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 302200097 2013-08-15 13:23:12,648 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 340200132 2013-08-15 13:23:13,866 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 360200095 2013-08-15 13:23:14,257 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 451100010 2013-08-15 13:23:15,601 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 610100027 2013-08-15 13:23:16,476 [6] INFO L1ID.TN_DL_2011.FacadeServer.DingService [(null)] - Sending ding request for OutboxID: 720400103 the dingService.log is normally 50,000 plus lines it will write the first cycle time but not the script then bombs out due to the blank line at the begining of the $binFile the $binfile is only temp to determine the time passing between each cycle
  12. I have been digging and can not find a way to delete the text in a file. i tried this This one is creating a blank line and causing script to crash FileClose($binFile) FileOpen($binFile,2) I also tried this one i get the error that the file does not get created, i think it never gets deleted as i can see it still in the directory with 2KB of data instead of 0. FileClose($binFile) $binFileDel = FileDelete($binFile) If $binFileDel = 0 Then ;;0 = Error MsgBox (0, "ERROR", "Error Deleting" & $binFile & @CRLF & "Exiting Program" ) Exit EndIf $binFileCreate = _FileCreate($binFile) If $binFileCreate <> 1 Then ;;0 = Error MsgBox (0, "ERROR", "Error Creating" & $binFile & @CRLF & "Exiting Program" ) Exit EndIf FileOpen($binFile,2) and a few other veriations, any ideas would be awesome. my main objective is to clear the $binFile so that i can write more data to it. if there is another way i am up for trying it. This is being processed from a log file of approx. 56000 lines and every 10 to 30 lines it will need to erase this file back to a blank slate.
  13. ok, i can do that. its a server log file so i have that information.
  14. oh, wow. Water, i just caught on to what you were saying and tested it. when it runs past the 24 hr mark it returns 12:1:11 so if i had a 23 hr time and 1hr comparison it will show something like 22 hrs difference instead of 1 - 2 hrs
  15. I know i showed millisecs in the original post but I did not have to add it, so the first was great, i am rewriting it to better fit my script but that was exactly what i was trying to do. thanks to all,
  16. just tested in my script, thats exactly what i was looking for. I was playing with _TicksToTime but i was not using it correctly. thank you
  17. I am trying to take 2 times and determine the difference, example: Time one 13:43:24,424 Time two 13:44:35:424 Time that has passed is 0:1:11,000 how can i get the time that has passed?
  18. I have tried both network and local(desktop) with same results. I will try it with my ad credentials and see what happens - did not think of doing that.
  19. was wanting to see if someone could look at this one more time. thanks Damon
  20. yes I do Compile it, I test on a separate computer from what I code on that does not have autoit installed on it. I have to due to the fact I need to make sure I am logged on as a user. I have used this in many other scripts in the past with no problems but for some reason it is not running or coming back with a PID, I have changed/checked the admin password to make sure it is the same as my variable in my code, Visually looking, do you see anything wrong with my code? This will give me a baseline of trouble shooting possibilities.
  21. Sorry, I did forget to mention that this is Windows XP. I tried #RequireAdmin but that prompted a box to come up and ask me to login as admin.
  22. I am having problems getting a script to run with admin rights. I have 3 different passwords due to different computers not receiving network updates/pushes to have admin password updated to one consistant. Everytime I run the script it does nothing and exits, so i put in some msgbox's to find out what is going on, and the return with "0" on all three. I have Windows SP3 on the computer and have read in other post that people are thinking that it is causing problems, I am not even able to get one run much less the 32 that they get before it quits working. I have changed the user name and passwords for this forum due to security reasons, any help would be appreciated. If $CmdLine[0] > 0 Then If $CmdLine[1] = "/UpdateOffice" Then UpdateOffice() Exit EndIf Local $user = "admin" Local $pass = "password" Local $pass2 = "password2" Local $pass3 = "password3" If IsAdmin () = 0 Then $run1 = RunAs ( $user, @ComputerName, $pass, 0,@ScriptFullPath & " /UpdateOffice") MsgBox (0,"",$run1) If $run1 = 0 Then $run2 = RunAs( $user, @ComputerName, $pass2, 0,@ScriptFullPath & " /UpdateOffice") MsgBox (0,"",$run2) If $run2 = 0 Then $run3 = RunAs ( $user, @ComputerName, $pass3, 0,@ScriptFullPath & " /UpdateOffice") MsgBox (0,"",$run3) If $run3 = 0 Then MsgBox (0,"",$run3) Exit EndIf EndIf EndIf EndIf UpdateOffice() UpdateOffice is calling the function with a gui that I built. I can attach it if I need but I seen the above being the problem. thanks, Damon
  23. i use contrlcommand and there is a "IsChecked" that returns a 1 if checked and a 0 if not and you can use the same command to check or uncheck the box. I have also found it better to use that send because you can tie it to button instances. damon oh, and to answer your question, $var = guictrlread($checkbox1) msgbox (0,"",$var) 1 = checked 4 = unchecked so you could do $var = guictrlread($checkbox1) if $var = 1 then msgbox(0,"","Checked") else msgbox(0,"","Unchecked") endif
  24. Holly Crap.... I just found it, well something that will get me what I want. _guictrltreeview_gettree it outputs c:|windows but i can stringsplit and add "\". thanks for your help "water" much appreciated. Damon here is the code i came up with. this may help someone later. $treeread1 = _GUICtrlTreeView_GetSelection($SelectDir) $txt3 = _GUICtrlTreeView_GetTree ($SelectDir, $treeread1) $txt4 = StringSplit ($txt3, "|",0) $x = 1 $txt5 = $txt4[1] Do $x = $x + 1 $txt5 = $txt5 & "\" & $txt4[$x] Until $x = $txt4[0]
  25. Well I am now getting the selected but not the full dir structure. any ideas? it will show me say "windows" being it is selected, but not "c:\windows" $treeread1 = _GUICtrlTreeView_GetSelection($SelectDir) $txt1 = _GUICtrlTreeView_GetText ($SelectDir, $treeread1) MsgBox (0,"",$txt1) MsgBox (0,"",$treeread1) ;FileOpenDialog ("Select Installation File", $treeread, "All (*.*)")
×
×
  • Create New...