Jump to content

Morronic

Members
  • Posts

    13
  • Joined

  • Last visited

Recent Profile Visitors

192 profile views

Morronic's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I have written a script that mounts shadow copies/previous versions without installing any software or using any external dll's. I know there is shadowExplorer but it requires a service to be installed. Mine uses only file read statements and works on everything except XP (Only because I couldn't test it, I don't have XP Machines). It even works on Server OS!I cleaned it up as best as I could and hopefully it's enough for those of you looking for something quick and easy to mount previous versions of files. Please use the version that is made for your O.S. Example: 64 bit operating systems compile the 64 bit, then run the compiled 64bit exe. Otherwise running it out of scite might not work. For those who don't know, previous versions can be useful if something gets accidentally deleted or a malware-encrypting virus hits your system, you can easily get it back (assuming that restore points have been made). Everything is free to copy/use as I believe in free stuff and I believe the best type of learning is dissecting other code and learning from it/ improving on it. Thanks for your time! -Morronic Vss-Morronic.au3
  2. In response to ChrisAnderson's Question. Try something like this. #include "EzMySql.au3" $ipAddress = @IPAddress1 _EzMySql_Startup("\MYSQL") $sqlConnect = _EzMySql_Open($ipAddress, "Username", "Password", "Database", 3306, "", 0) ;This opens a connection to the mysql database. Change Username Password and Database to YOUR mysql Database settings. _EzMySql_Query('SELECT * FROM News') ;News is the table that I am getting data from. Change News to the name of the Table you want to query. $myRows = _EzMySql_Rows() ;Just counts the rows that have data in them. _EzMySql_QueryFinalize() $i = 1 $row = _EzMySql_GetTable2d('SELECT * FROM News') ;Makes a 2d array of data. _EzMySql_QueryFinalize() Do MsgBox(0, "", $row[$i][1] & @CRLF & $row[$i][2]) $i = $i + 1 Until $i = $myRows + 1 _EzMySql_Close() This works for me because I only have 2 fields of data. If you have a bunch of fields of data you would have to go much higher than two in the MsgBox. For example. Let's say I had 4 fields of Data. I would have to call the array like this: MsgBox(0, "", $row[$i][1] & @CRLF & $row[$i][2] & @CRLF & $row[$i][3] & @CRLF & $row[$i][4]) This would display all 4 fields of information. This works because _EzMySql_GetTable2d() function makes a 2d array. You pull out the data from the array by using Column and Row. Column is number up and down. Row is number left and right. Which is why we call the variable $row like $row[1][1]. That says we are displaying data from Column1, Row1. Hopefully this helps anyone else struggling with this UDF as well.
  3. Check out Windows Task Scheduler. Have the Message Box give a time of the error, that way you can tell what time the error was found. You can make scheduled tasks run even if another instance is already running http://windows.microsoft.com/en-us/windows/schedule-task#1TC=windows-7
  4. Not sure exactly what you're trying to accomplish but I think you should check out the help section on For To Loops. Or Do While loops. $MyIni = "variables.ini" $i = 0 For $i = 0 To 4 Step + 1 IniWrite($MyIni, "TestSection", "Key" & $i, $i) Next Run("C:\Windows\notepad.exe " & $MyIni) An example of a For To loop.
  5. I'm a little confused about the question. The Script works fine for me? Do you mean like this? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 298, 294, 192, 124) $List1 = GUICtrlCreateListView("Item1|Item2", 40, 40, 161, 136) $Button1 = GUICtrlCreateButton("Button1", 80, 184, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlCreateListViewItem("Test 1|Test 2", $List1) EndSwitch WEnd
  6. RunWait("cleanmgr.exe /sagerun:99") If @error = 0 Then MsgBox(64, "Success", "Cleanup Success", 5) ElseIf @error > 0 Then MsgBox(16, "ERROR", "Cleanup Failed", 5) EndIf
  7. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> Opt("WinTitleMatchMode", 4) Global $hMigration, $hExplHolder, $hExplorer, $sStartDir = "C:\" Global $iWidth = @DesktopWidth - 200, $iHeight = @DesktopHeight - 200 ; Create the (left) Explorer GUI $hExplHolder = GUICreate("Explorer", $iWidth, $iHeight, Default, Default) Run('explorer.exe /n, "' & $sStartDir & '"') WinWait("[CLASS:CabinetWClass]") $hExplorer = WinGetHandle("[CLASS:CabinetWClass]") WinSetState($hExplorer, "", @SW_HIDE) WinMove($hExplorer, "", 0, 0, $iWidth, $iHeight) _WinAPI_SetParent($hExplorer, $hExplHolder) _WinAPI_SetWindowLong($hExplorer, $GWL_STYLE, -1064828928) ControlListView($hExplorer, "", "[CLASS:SysListView32; INSTANCE:1]", "ViewChange", "list") $hList = GUICtrlCreateListView ("File", $iWidth + 4, 4, 292, 200, 0x0003 + 0x0008 + 0x0004) GUICtrlSetState (-1, 8) WinSetState($hExplorer, "", @SW_SHOW) GUISetState(@SW_SHOW, $hExplHolder) While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case -13 GUICtrlCreateListViewItem (@GUI_DRAGFILE, $hList) EndSwitch WEnd Made it full screen so the person can see everything without that sidebar junk that was going on. Try this instead and change it to your code.
  8. ;################################## ; Include ;################################## #Include <file.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;################################## ; Main Window For Input Email and Body ;################################## Func sendMail() Global $fileVer = "1.0" $Form1 = GUICreate("Mailer V" & $fileVer, 921, 701, -1, -1) GUISetFont(10, 400, 0, "Times New Roman") Global $inputEmail = GUICtrlCreateInput("", 408, 56, 217, 23) Global $inputSubject = GUICtrlCreateInput("", 408, 96, 217, 23) Global $inputMessage = GUICtrlCreateEdit("", 144, 152, 649, 409, $ES_WANTRETURN) $buttonSend = GUICtrlCreateButton("Send", 536, 600, 105, 33) $Label1 = GUICtrlCreateLabel("Enter Client's Email:", 272, 56, 124, 23) GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman") $Label2 = GUICtrlCreateLabel("Message:", 48, 304, 73, 25) GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman") $buttonCancel = GUICtrlCreateButton("Cancel", 224, 600, 105, 33) $Label3 = GUICtrlCreateLabel("Enter Subject:", 288, 96, 89, 23) GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $buttonSend ExitLoop Case $buttonCancel Exit EndSwitch WEnd EndFunc ;################################## ; Variables ;################################## $SmtpServer = "smtp.Example.com" ; address for the smtp-server to use - REQUIRED $FromName = "Example" ; name from who the email was sent $FromAddress = "[email protected]" ; address from where the mail should come $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "[email protected]" ; username for the account used from where the mail gets sent - REQUIRED $Password = "********" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 465 ; port used for sending the mail $ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS ;~ $IPPort=465 ; GMAIL port used for sending the mail ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS ;################################## ; Script ;################################## sendMail() $Subject = GUICtrlRead($inputSubject) ; subject from the email - can be anything you want it to be $Body = GUICtrlRead($inputMessage) ; the messagebody from the mail - can be left blank but then you get a blank mail $ToAddress = GUICtrlRead($inputEmail) ; destination address of the email - REQUIRED Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) EndIf ; ; The UDF Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf If $ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail="" EndFunc ;==>_INetSmtpMailCom ; ; ; Com Error Handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc In case anyone wants it I made a basic GUI to the program. Obviously before you compile or run change the settings such as port #, server, Email address, etc. Of course any issues let me know or yell at me for my horrible code Anyway hope it helps someone
  9. Thank you!! I have been struggling with this for months now I could seriously hug you..
  10. Wow thank you. So simple haha I couldn't figure out what was going on. I get it now, I need to make global variables before the include. Otherwise they won't be declared in the include. Thank you again!!
  11. I think i'm just not getting how #include works. It add's other external scripts and just compiles into one right? Because I added everything in testGui but testGuiTwo doesn't see the globally assigned variables and I think this is what is causing headaches in some of my other unfinished projects.. And the only reason I don't add it all into one big file is sometimes I write stuff while I am on another computer and it's easier to just transfer the file and type #include but maybe it's not doing what I think it is.
  12. I attached testGui.au3 which is the main window and testGuiTwo.au3 which is the second window that uses the globally declared variables, however I don't think I am declaring the variables properly/calling them correctly, or understand how to properly use them. Hopefully this makes sense of what I am asking. Thanks for your time! -Morronic testGui.au3 testGuiTwo.au3
  13. Hey everyone i'm not new by any means to autoit but I have some questions that I may need more experienced users help with. Lately I've been having some issues with scripts that say "Error Line 7046, Variable used without being declared". This all started when I started writing scripts that call on other external scripts i've been writing. For example I will write #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include "copyFile.au3" Inside that "copyFile.au3" script that I linked externally, do I also need to add #include <GUIConstantsEx.au3> or does it automatically use the one's listed in the main script? Anyway I hope i'm not double posting this I just cant seem to find this information anywhere and i'm hoping this is why it's erroring out. Thanks! -Morronic
×
×
  • Create New...