Sign in to follow this  
Followers 0
Medic873

Finding File

14 posts in this topic

Okay this software is being ran on sevral computers..

And currently it saves a log to the path C:\LOGFILE.txt

And at the end of everyday it sends the file through a email... It attaches it Im simple using the script provided here

http://www.autoitscript.com/forum/topic/23860-smtp-mailer-that-supports-html-and-attachments/page__st__340__p__860704__hl__email__fromsearch__1#entry860704

but for some reason I have it where the file C:\LOGFILE.txt is attached and whenever it runs on another computer it says it cant send the email...

Im not sure why it cant send it but I assume its because of the file path being different in some way...

weather its cause of the username on the computer of what im not sure but can someone please help me fix this thank you.

Share this post


Link to post
Share on other sites



is there any way to disable all firewalls programmable

Share this post


Link to post
Share on other sites

What is the error code that is returned?

Share this post


Link to post
Share on other sites

o I belive one second

error code 1 Description 0

Share this post


Link to post
Share on other sites

In the UDF to which you linked, SetError(1) shows that the error is: "File not found to attach:".

You'll need add code to search for the file that you want to attach or at least to make sure that the file exists before you add the attachment.

Share this post


Link to post
Share on other sites

I understand that but Im not sure how to do it lol....

Share this post


Link to post
Share on other sites

Maybe >> _FileListToArray() or for Recursive check out _RecFileListToArray() created by Melba23!


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I understand that but Im not sure how to do it lol....

On the machines that the script is not working, have you manually check it the Lofgile.txt exists? If it does, where is it (on the root of another drive, in another folder). On these machines, if it does exist, is it in the same place. Or is it located on different places on all the machines? And if the file does exist, is there some text in it that would differentiate it between any other "Logfile.txt" files on the same computer?

If the file does not exist on all the non-working machines, you can add a line like

If Not FileExists("C:\Logfile.txt") Then Exit

If the file exists but just not in the C:\ drive, I was hoping to narrow down where it could be rather than searching every folder on every drive, which could take a long time. If we found more than 1 file named "Logfile.txt", we would need some unique text (like today's date) in order to determine which file we would need to send.

You'll need to give more info in order for us to further help you.

Share this post


Link to post
Share on other sites

Okay its no issue naming the file something wired such as 1982keifile912.txt but how would I make it search every file and folder on the computer to find it and second yes it is always in the same place because im saving it to a windows file that is always there on vista win 7 and xp.

Share this post


Link to post
Share on other sites

how would I make it search every file and folder on the computer to find it

>>

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Okay its no issue naming the file something wired such as 1982keifile912.txt but how would I make it search every file and folder on the computer to find it and second yes it is always in the same place because im saving it to a windows file that is always there on vista win 7 and xp.

Is the file in random places on each machine? How is determined (by the program that creates the file) where to store it? If you can rename the file manually, why not just (manually) move it to where you want it to be? If this is a scheduled process, I think that the better solution is to figure out a pattern of where the file is created for each computer. Why would you want to search through GBs of data on each occurrence you want to send the email when you could just read a registry file (for example) and determine the program's out path for the log file. Or at the very least, determine where the Logfile is for each computer and assume that it will always output to that path and customize the script so that the location corresponds to the computer name like

Switch @Computername
  Case "Name1"
    $Location = "C:\Logfile.txt"
  Case "Name2"
    $Location = "D:\Logfile.txt"
EndSwitch

If the path changes randomly on each computer each time that the program that creates is run, then you'll have no choice but to search each hard drive every time you want to run your email script. However, it will be better procedure to come up with the most simple pattern to determine the file's location so that we can determine it for each computer with a single script. The most universal solution may not be the most efficient solution.

Edited by Varian

Share this post


Link to post
Share on other sites

well it should be always saving the file to c:\windows\logfile.txt

but for some reason when it gose to send it. the file cant be found but if I mannuly go looking for it its right there at c:\windows\logfile.txt

Share this post


Link to post
Share on other sites

well it should be always saving the file to c:\windows\logfile.txt

but for some reason when it gose to send it. the file cant be found but if I mannuly go looking for it its right there at c:\windows\logfile.txt

OK, so this issue is the script not locating the file. Do you think that this is a permissions issue? Have you tried #RequireAdmin at the top of your script? You can also add the snippet before defining the attachment variable

$Clock = TimerInit()
Do
  Sleep(100)
  $Timer =  TimerDiff($Clock)
Until FileExists('C:\Windows\logfile.txt') Or $Timer > 5000  ;breaks out after 5 seconds
If $Timer > 5000 Then $AttachFiles = ''

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0