-
Posts
226 -
Joined
-
Last visited
Recent Profile Visitors
369 profile views
grimmlock's Achievements
-
Thanks MikahS, I tried both of those on 2 seperate computers and I am still getting the same result, nothing happens. I even added a msgbox to alert me when the program was active, and the msgbox works but not Send("{Tab}") Send("{Space}") Thanks Grimm
- 5 replies
-
- ControlSend()
- Send()
-
(and 1 more)
Tagged with:
-
Wierd, I cannot get it to work on my computer. I will try on another computer.
- 5 replies
-
- ControlSend()
- Send()
-
(and 1 more)
Tagged with:
-
Hey everyone I want to be able to press a button within a application however so far what I have tried does not seem to be working. I have successfully made the application (window) active, but when I try: WinActivate("- AdwCleaner - v4.109") WinWaitActive("- AdwCleaner - v4.109") send("{Tab}{Space}") ; even ("{TAB}{SPACE}") WinActivate("- AdwCleaner - v4.109") WinWaitActive("- AdwCleaner - v4.109") ControlSend("- AdwCleaner - v4.109", "", "[CLASSNN:Button3]", "{SPACE}") WinActivate("- AdwCleaner - v4.109") WinWaitActive("- AdwCleaner - v4.109") ControlClick("- AdwCleaner - v4.109", "Scan", "[CLASS:Button;INSTANCE:3]") I have tried using the finder utility and that is how I got the Class and instance number but nothing is working. Could someone help? Thanks Grimm
- 5 replies
-
- ControlSend()
- Send()
-
(and 1 more)
Tagged with:
-
Array pipe character used for next line
grimmlock replied to grimmlock's topic in AutoIt General Help and Support
Very clear thank you for the help and explination, as always I am humbled But now the hard part for me, I need to somehow take the data from the array and use it set some of the variables . -
I am making an app that will allow the migration of users from one server to another (while changing permissions) easier for anyone and everyone. Below is my code, what I can't seem to figure out is what I am missing in my code so that the _uArray() reads the folder names in the destination folder and then uses them to set some of the permissions settings. Right now the array pulls the data just fine, but either puts a "|" between the names (which I understand is "normal") or it removes the "|" and puts the folder names together in one long string, which is why I used StringSplit() only now it does not display anything at all. If anyone has time, would it be possible for someone to look at this and help me solve this issue. I think it would a great app that anyone can use that, like me, needs to migrate users across domains or servers. Thank you in advance. #include <GUIConstantsEx.au3> #include <AutoItConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> #include <Constants.au3> #include <FileConstants.au3> #include <ButtonConstants.au3> #include <File.au3> #include <Array.au3> #include <StringConstants.au3> Global $set = 3 ;==========================Main GUI=========================== $hGUI = GUICreate("Complex-Permissions", 250, 350) ;============================================================= ;==========================Inputs============================= $hOld = GUICtrlCreateInput("", 95, 25, 130) $hNew = GUICtrlCreateInput("", 95, 50, 130) $hOldSvr1 = GUICtrlCreateInput("", 95, 75, 25) GUICtrlSetLimit(-1, $set) $hOldSvr2 = GUICtrlCreateInput("", 130, 75, 25) GUICtrlSetLimit(-1, $set) $hOldSvr3 = GUICtrlCreateInput("", 165, 75, 25) GUICtrlSetLimit(-1, $set) $hOldSvr4 = GUICtrlCreateInput("", 200, 75, 25) GUICtrlSetLimit(-1, $set) $hNewSvr1 = GUICtrlCreateInput("", 95, 100, 25) GUICtrlSetLimit(-1, $set) $hNewSvr2 = GUICtrlCreateInput("", 130, 100, 25) GUICtrlSetLimit(-1, $set) $hNewSvr3 = GUICtrlCreateInput("", 165, 100, 25) GUICtrlSetLimit(-1, $set) $hNewSvr4 = GUICtrlCreateInput("", 200, 100, 25) GUICtrlSetLimit(-1, $set) $hLetter = GUICtrlCreateInput("", 95, 125, 130) $hShare = GUICtrlCreateInput("", 95, 150, 130) $hLocal = GUICtrlCreateInput("", 95, 175, 130) $hFolder = GUICtrlCreateInput("", 95, 200, 130) $hUID = GUICtrlCreateInput("", 95, 225, 130) $hExclude = GUICtrlCreateInput("", 95, 250, 130) ;============================================================= ;==========================Buttons============================ $hButton1 = GUICtrlCreateButton("Test", 25, 285, 50) ;~ GUICtrlSetState(-1, $GUI_HIDE) $hButton2 = GUICtrlCreateButton("Migrate Data / " & @CRLF & "Change Permissions", 100, 285, 120, 50, $BS_MULTILINE) ;============================================================= ;==========================Labels============================= $hLabel1 = GUICtrlCreateLabel("Old Domain", 10, 28) $hLabel2 = GUICtrlCreateLabel("New Domain", 10, 53) $hLabel3 = GUICtrlCreateLabel("Old Server (IP)", 10, 78) $hLabel4 = GUICtrlCreateLabel("New Server (IP)", 10, 103) $hLabel5 = GUICtrlCreateLabel("Drive Letter", 10, 128) $hLabel5 = GUICtrlCreateLabel("Share Folder", 10, 153) $hLabel6 = GUICtrlCreateLabel("Local Folder", 10, 178) $hLabel7 = GUICtrlCreateLabel("Folder Name", 10, 203) $hLabel8 = GUICtrlCreateLabel("User Name", 10, 228) $hLabel9 = GUICtrlCreateLabel("Exclusions", 10, 253) ;============================================================= GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMSG() Case $GUI_EVENT_CLOSE ExitLoop Case $hButton1 _uArray() Case $hButton2 ;~ _NetUse() ;~ _RoboCopy() _Perm() EndSwitch WEnd ;============================================================= ;~ Functions ;============================================================= Func _NetUse() RunWait(@ComSpec & " /c " & "net use \\" & GUICtrlRead($hOldSvr1) & "." & GUICtrlRead($hOldSvr2) & "." & GUICtrlRead($hOldSvr3) & "." & GUICtrlRead($hOldSvr4) & "\c$ /user:" & GUICtrlRead($hOld) & "\axeontech", "", @SW_HIDE) RunWait(@ComSpec & " /c " & "net use \\" & GUICtrlRead($hOldSvr1) & "." & GUICtrlRead($hOldSvr2) & "." & GUICtrlRead($hOldSvr3) & "." & GUICtrlRead($hOldSvr4) & "\Admin$ /user:" & GUICtrlRead($hOld) & "\axeontech", "", @SW_HIDE) Sleep(2000) EndFunc ;= _NetUse Func _RoboCopy() If GUICtrlRead($hExclude) <> "" then RunWait(@ComSpec & " /k " & "robocopy /B \\" & GUICtrlRead($hOldSvr1) & "." & GUICtrlRead($hOldSvr2) & "." & GUICtrlRead($hOldSvr3) & "." & GUICtrlRead($hOldSvr4) & "\" & GUICtrlRead($hShare) & "\" & GUICtrlRead($hFolder) & " \\" & GUICtrlRead($hNewSvr1) & "." & GUICtrlRead($hNewSvr2) & "." & GUICtrlRead($hNewSvr3) & "." & GUICtrlRead($hNewSvr4) & "\" & GUICtrlRead($hShare) & "\" & GUICtrlRead($hFolder) & " /E /mir /XD " & GUICtrlRead($hFolder) & "\" & GUICtrlRead($hExclude) & "/w:0 /r:0 /log:c:\users\" & @UserName & "\desktop\migrate_profiles.txt", "", @SW_SHOW) MsgBox(0, "", "RoboCopy w/ Exceptions: Complete") Else RunWait(@ComSpec & " /k " & "robocopy /B \\" & GUICtrlRead($hOldSvr1) & "." & GUICtrlRead($hOldSvr2) & "." & GUICtrlRead($hOldSvr3) & "." & GUICtrlRead($hOldSvr4) & "\" & GUICtrlRead($hShare) & "\" & GUICtrlRead($hFolder) & " \\" & GUICtrlRead($hNewSvr1) & "." & GUICtrlRead($hNewSvr2) & "." & GUICtrlRead($hNewSvr3) & "." & GUICtrlRead($hNewSvr4) & "\" & GUICtrlRead($hShare) & "\" & GUICtrlRead($hFolder) & " /E /mir /w:0 /r:0 /log:c:\users\" & @UserName & "\desktop\migrate_profiles.txt", "", @SW_SHOW) MsgBox(0, "", "RoboCopy w/o Exceptions: Complete") EndIf ;~ Sleep(2000) EndFunc ;= _RoboCopy Func _Perm() ;~ If GUICtrlRead($hLocal) = "" then ;~ GUICtrlSetData($hLocal, GUICtrlRead($hShare)) ;~ EndIf Local $hFileOpen = FileOpen("c:\users\" & @UserName & "\desktop\log.txt", $FO_APPEND) Local $iPID = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&TAKEOWN /f " & GUICtrlRead($hFolder) & " /r /d y", "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID) Local $sOutput = StdoutRead($iPID) FileWrite($hFileOpen, $sOutput) ;~ Sleep(1000) Local $iPID1 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /reset /T", "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID1) Local $sOutput = StdoutRead($iPID1) FileWrite($hFileOpen, $sOutput) Local $iPID2 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & "\*.* /inheritance:d /c /t", "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID2) Local $sOutput = StdoutRead($iPID2) FileWrite($hFileOpen, $sOutput) Local $iPID3 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /grant " & '"' & 'system":(OI)(CI)F /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID3) Local $sOutput = StdoutRead($iPID3) FileWrite($hFileOpen, $sOutput) Local $iPID4 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /grant " & '"' & @ComputerName & '\administrator":(OI)(CI)F /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID4) Local $sOutput = StdoutRead($iPID4) FileWrite($hFileOpen, $sOutput) Local $iPID5 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /grant " & '"' & @ComputerName & '\administrators":(OI)(CI)F /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID5) Local $sOutput = StdoutRead($iPID5) FileWrite($hFileOpen, $sOutput) Local $iPID6 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /grant " & '"' & GUICtrlRead($hNew) & '\domain admins":(OI)(CI)F /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID6) Local $sOutput = StdoutRead($iPID6) FileWrite($hFileOpen, $sOutput) Local $iPID7 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /grant " & '"' & GUICtrlRead($hNew) & '\' & GUICtrlRead($hUID) & '":(OI)(CI)F /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID7) Local $sOutput = StdoutRead($iPID7) FileWrite($hFileOpen, $sOutput) Local $iPID8 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /setowner " & '"' & GUICtrlRead($hNew) & '\' & GUICtrlRead($hUID) & '" /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID8) Local $sOutput = StdoutRead($iPID8) FileWrite($hFileOpen, $sOutput) Local $iPID9 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & "\*.* /remove:g " & '"' & 'everyone" /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID9) Local $sOutput = StdoutRead($iPID9) FileWrite($hFileOpen, $sOutput) Local $iPID10 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & "\*.* /remove:g " & '"' & GUICtrlRead($hNew) & '\axeontech" /c /t', "", @SW_HIDE, $STDERR_MERGED) ; ProcessWaitClose($iPID10) Local $sOutput = StdoutRead($iPID10) FileWrite($hFileOpen, $sOutput) FileClose($hFileOpen) MsgBox(0, "", "Permissions Change: Complete") EndFunc ;= _Perm Func _uArray() $fFileList = _FileListToArray(GUICtrlRead($hLetter) & ":\" & GUICtrlRead($hLocal), "*", 2) ;~ _ArrayDisplay($fFileList, "$fFileList") $fFolder = _ArrayToString($fFileList, "|") $fSplit = StringSplit($fFolder, "|", $STR_ENTIRESPLIT) Run("Notepad") Sleep(1000) For $i = 1 To $fSplit[0] Send($fSplit[$i]) Next EndFunc
-
I have spent the past couple of hours trying to find a solution to this. Is there a way to output the data from a RunWait to a text file? I need to use the RunWait as I need each command to complete before the next one starts. Any help would be greatly appreciated. I have tried RunWait(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hPath) & "&&TAKEOWN /f " & GUICtrlRead($hFolder) & " /r /d y" > "C:\log.txt", "", @SW_HIDE) But that does not work either. Here is my code: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> ;=============Main=GUI================= $hGUI = GUICreate("", 250, 500) ;====================================== ;=================Inputs=============== $hOld = GUICtrlCreateInput("", 95, 25, 130) $hNew = GUICtrlCreateInput("", 95, 50, 130) $hOldSvr1 = GUICtrlCreateInput("", 95, 75, 25) GUICtrlSetLimit(-1, 3) $hOldSvr2 = GUICtrlCreateInput("", 130, 75, 25) GUICtrlSetLimit(-1, 3) $hOldSvr3 = GUICtrlCreateInput("", 165, 75, 25) GUICtrlSetLimit(-1, 3) $hOldSvr4 = GUICtrlCreateInput("", 200, 75, 25) GUICtrlSetLimit(-1, 3) $hNewSvr1 = GUICtrlCreateInput("", 95, 100, 25) GUICtrlSetLimit(-1, 3) $hNewSvr2 = GUICtrlCreateInput("", 130, 100, 25) GUICtrlSetLimit(-1, 3) $hNewSvr3 = GUICtrlCreateInput("", 165, 100, 25) GUICtrlSetLimit(-1, 3) $hNewSvr4 = GUICtrlCreateInput("", 200, 100, 25) GUICtrlSetLimit(-1, 3) $hLetter = GUICtrlCreateInput("", 95, 125, 130) $hPath = GUICtrlCreateInput("", 95, 150, 130) $hFolder = GUICtrlCreateInput("", 95, 175, 130) $hUID = GUICtrlCreateInput("", 95, 200, 130) $hExclude = GUICtrlCreateInput("", 95, 225, 130) ;====================================== ;=================Buttons============== $hButton1 = GUICtrlCreateButton("Test", 50, 260, 50) ;====================================== ;=================Labels=============== $hLabel1 = GUICtrlCreateLabel("Old Domain", 10, 28) $hLabel2 = GUICtrlCreateLabel("New Domain", 10, 53) $hLabel3 = GUICtrlCreateLabel("Old Server (IP)", 10, 78) $hLabel4 = GUICtrlCreateLabel("New Server (IP)", 10, 103) $hLabel5 = GUICtrlCreateLabel("Drive Letter", 10, 128) $hLabel5 = GUICtrlCreateLabel("Folder Path", 10, 153) $hLabel6 = GUICtrlCreateLabel("Folder Name", 10, 178) $hLabel7 = GUICtrlCreateLabel("User Name", 10, 203) $hLabel8 = GUICtrlCreateLabel("Exclusions", 10, 228) ;====================================== GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMSG() Case $GUI_EVENT_CLOSE ExitLoop Case $hButton1 _TestOnly() EndSwitch WEnd Func _TestOnly() RunWait(@ComSpec & " /k " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hPath) & "&&TAKEOWN /f " & GUICtrlRead($hFolder) & " /r /d y") RunWait(@ComSpec & " /k " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hPath) & "&&icacls " & GUICtrlRead($hFolder) & " /reset /T") RunWait(@ComSpec & " /k " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hPath) & "&&icacls " & GUICtrlRead($hFolder) & "\*.* /inheritance:d /c /t") EndFunc
-
Write to file each time window is opened
grimmlock posted a topic in AutoIt General Help and Support
I am looking for some help with my code. I want to be able to have this script always run, and append a file each time a program is opened adding a new line. Here is my code, and help would be greatly appreciated. #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <File.au3> Local $aLines, $iCount = 0 local $hDate = @YEAR & '-' & @MON & '-' & @MDAY & ' ' & @HOUR & ':' & @MIN & ':' & @SEC local $hfile=FileOpen("C:\Users\public\Desktop\new1.txt", $FO_APPEND) Local $hComputername = @ComputerName ; Computer Name Local $hUsername = @UserName ; User Name While 1 If $hfile = -1 Then SplashTextOn("Error", "Unable to open and append the log file.", 300, 50) Sleep(2000) SplashOff() EndIf _FileReadToArray("C:\Users\public\Desktop\new1.txt", $aLines) If Not @error Then ; if the file exists look for the ID starting on the last line For $i = $aLines[0] To 1 Step -1 If StringLeft($aLines[$i], 2) == "id" Then ; get the ID number $iCount = Int(StringRegExpReplace($aLines[$i], "id(\d*):.*", "$1")) ExitLoop EndIf Next ; Check we found an ID If $i = 0 Then MsgBox(0, "Error", "No line id found") Exit EndIf EndIf If WinExists("[Class:Notepad]", "") Then FileWrite($hfile, _LineID() & '|' & $hDate & '|' & $hComputername & '|' & "Notepad was opened by " & $hUsername & @CRLF) Sleep(10) FileClose($hfile) Sleep(1000) EndIf WEnd Func _LineID() $iCount += 1 Return "id" & StringFormat("%04i", $iCount) & ": " EndFunc ;==> LineID Thanks! -
Only 64 bit compiled script works on Exchange
grimmlock replied to grimmlock's topic in AutoIt General Help and Support
Update: Thank you all for your Help. I do not know how or why but apparently I asked this question last year, and the solution was to just compile the script in x64 which will soon work once we move all of our MS Servers from 32 bit to 64 bit. In my earlier post there was a reference (from Water, sorry Water), like in this post, to CDO and Obj.Create. After doing some digging online, I came across this article https://groups.google.com/forum/#!topic/microsoft.public.scripting.vbscript/P1HWPmBHL8o which referenced this: regsvr32 C:WindowsSysWOW64cdosys.dll. On our 64 bit exchange server I ran this command and now I am able to successfully run the 32 bit compiled script / app. Thank you to Water, Boththose and Danp2 for all of you help and for your patience with me. Have a great rest of the day! -
Only 64 bit compiled script works on Exchange
grimmlock replied to grimmlock's topic in AutoIt General Help and Support
Thank you all for your help, I wanted to update this post with the following information: I installed Autoit and SciTE onto the exchange server so I could get a better reading on lines that are having appear to be having the issues. They appear to be in this section: Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $sBody = "", $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 $MyManager <> "" Then ;~ $objEmail.Cc = $MyManager ;~ EndIf If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($sBody, "<") And StringInStr($sBody, ">") Then $objEmail.HTMLBody = $sBody Else $objEmail.Textbody = $sBody & @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 $goMyRet EndIf $objEmail = "" EndFunc ;==>_INetSmtpMailCom The line numbers are 272, 273, 280, 284, 301, 302, 304, 315, 321, 325, 327. Which are $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress $objEmail.Subject = $s_Subject $objEmail.Textbody = $sBody & @CRLF $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 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort $objEmail.Configuration.Fields.Update $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal" $objEmail.Fields.Update $objEmail.Send -
Only 64 bit compiled script works on Exchange
grimmlock replied to grimmlock's topic in AutoIt General Help and Support
Boththose, Please forgive my ignorance, but where, in the script, would I put the DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)? Water, I did a splashtexton and got a screenshot of the output, and attached the screenshot. Thanks. -
Only 64 bit compiled script works on Exchange
grimmlock replied to grimmlock's topic in AutoIt General Help and Support
One thing I think I forgot to mention, is that I am compiling this script as a 32 bit app so that it works on both the 32 bit MS OS and 64 bit MS OS Servers. So far it works great on both types, except when I run it on the 64 bit Exchange server. What happens is that it completes but the email is never sent/received. Therefore, I do not think that there is a specific line that is failing. Here is the entire script: #NoTrayIcon #include <Timers.au3> #include <misc.au3> #include <File.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Process.au3> #include <WinAPI.au3> #include <GUIComboBox.au3> #Include <String.au3> #include <Icons.au3> #include <GUITab.au3> #include <GUIButton.au3> Global $goMyRet[2] Global $goMyError = ObjEvent("AutoIt.Error", "MyErrFunc") HotKeySet("#{F4}", "_exit") ; Ctrl-Shift-Alt-X to exit _main() Func _Main() while 1 _GUI() WEnd EndFunc ;==>_Main Func _gui() Local $sUsername = @UserName ; User Name Local $sComputername = @ComputerName ; Computer Name Local $sText1 = ""; Output text for message box. Local $sText2 = ""; Output text for message box. Local $sTest3 = ""; Output text for message box. Local $combo1 = ""; Output text for combo box. Local Const $sDomain = 'domain.com' Local Const $sServer = "mail" & '.' & $sDomain Local Const $sSupportEmail = "user" & '@' & $sDomain ClipPut($sServer) $sText1 = "Username = " & $sUsername & @CRLF ; The & character concentrates (joins) two values together. $sText2 = "Computer Name = " & $sComputername & @CRLF ; The &= adds to the variable. The same as doing $var = $var & "extra stuff" Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP,"SpecialEvent") Local $hMainwindow = GUICreate("HelpDesk App", 300, 620, Default, Default, BitAND($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_CONTEXTHELP) GUICtrlCreateLabel("Helpdesk App", 30, 10, 290, 40) GUICtrlSetFont(-1, 20, 800); bold GUICtrlCreateLabel($sText1, 25, 60) GUICtrlCreateLabel($sText2, 25, 78) local $hShinkButton = GUICtrlCreateButton("&Hide", 90, 550, 80) ;*Commented Out; Would like to learn how to create a form and clear the data Local $hOkButton = GUICtrlCreateButton("&Send", 180, 550, 80) ; _AddHorzSep(10, 40, 290) _AddHorzSep(10, 105, 280) _AddHorzSep(10, 210, 280) GUICtrlCreateLabel("*Please provide the above information when you contact the Help Desk for any hardware or software problems.", 20, 120, 250, 50) GUICtrlCreateLabel("Helpdesk #:", 85, 173) GUICtrlCreateLabel("&Helpdesk Email:", 70, 188) $hEmail = GUICtrlCreateLabel($sSupportEmail, 148, 188);helpdesk@domain.com" GUICtrlSetFont($hEmail, 8.5, -1, 4) ; underlined GUICtrlSetColor($hEmail, 0x0000ff) GUICtrlSetCursor($hEmail, 0) GUICtrlCreateLabel("Helpdesk Request Form", 30, 220, 270, 50) GUICtrlSetFont(-1, 15, 800); bold GUICtrlCreateLabel("Request &Type:", 25, 273, 75) Global $hCombo = GUICtrlCreateCombo("", 100, 270, 160) ; create first item GUICtrlSetData(-1, "Keyboard/Mouse|Monitor|Desktop|Laptop|Other Hardware|Windows 7|Windows XP", "Keyboard/Mouse") ; add other item snd set a new default GUICtrlCreateLabel("&Subject:", 25, 303, 75) Global $hInputText = GUICtrlCreateInput("", 100, 300, 160) GUICtrlCreateLabel("Attach File:", 25, 333, 75) Global $hInputEdit2 = GUICtrlCreateEdit("", 100, 330, 160, Default, $ES_READONLY) $hBrowseButton = GUICtrlCreateButton("Browse", 185, 355, 75) GUICtrlCreateLabel("&Details:", 25, 363, 75) Global $hInputText2 = GUICtrlCreateEdit("", 25, 385, 235, 150, BitOR($ES_WANTRETURN, $ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $ES_NOHIDESEL)) GUISetState() While 1 Switch GUIGetMsg() Case $hBrowseButton Global $file1 = FileOpenDialog('Choose file...', @DesktopDir, 'All Image Types (*.bmp;*.png;*.jpeg;*.gif;*.jpg;*.tiff)|Word (*.doc;*.docx;*.txt)', 1 + 4) Local $szDrive, $szDir, $szFName, $szExt $FilePath = _PathSplit($file1, $szDrive, $szDir, $szFName, $szExt) ;~ _ArrayDisplay($TestPath, "Demo _PathSplit()") GuiCtrlSetData($hInputEdit2, $szFName & $szExt) Case $hOkButton $msg = "Subject: " & GUICtrlRead($hInputText) & @CRLF & @CRLF & "Details: " & GUICtrlRead($hInputText2) & @CRLF & @CRLF & "" & $sText1 & $sText2 & _wmigetcompinfo() If GUICtrlRead($hInputEdit2) = '' Then Global $s_AttachFiles = '' Else Global $s_AttachFiles = $file1 EndIf OKButton($sServer, $sUsername, $sUsername & '@' & $sDomain, $sSupportEmail, "Issue: " & GUICtrlRead($hCombo), $msg) Sleep(10) _Cleardata() Case $hEmail OnEmail($sSupportEmail) ;- Case $GUI_EVENT_CLOSE ;- GUISetState(@SW_HIDE, $hMainwindow) Case $hShinkButton GUISetState(@SW_HIDE, $hMainwindow) TraySetState(1) ; show TraySetToolTip ("Helpdesk App") EndSwitch WEnd EndFunc Func _Cleardata() GUICtrlSetData($hCombo, "Keyboard/Mouse") GUICtrlSetData($hInputText, "") GUICtrlSetData($hInputEdit2, "") GUICtrlSetData($hInputText2, "") Sleep(1000) EndFunc Func SpecialEvent() GUISetState(@SW_SHOW) TraySetState(2) ; hide EndFunc Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Func _AddHorzSep($iX, $iY, $iW) GUICtrlCreateLabel("", $iX, $iY, $iW, 1) GUICtrlSetBkColor(-1, 0x000000) EndFunc ;==>_AddHorzSep Func _exit() Do $Pass = InputBox ("Password", "Please enter your password", "", "*M", 50, 150) $Split = StringSplit ($Pass, "") ;~ If $Split[0] Then $ConfirmPass = "pa$$w0rd" If $Pass <> $ConfirmPass Then MsgBox (48, "Error", "Passwords do not match!!") ;~ EndIf Until $Pass = $ConfirmPass SplashTextOn( "", "Closing", 150, 50) Sleep(2000) Exit ;~ EndIf EndFunc Func _wmigetcompinfo($strComputer = "localhost") ; Generated by AutoIt Scriptomatic November 30, 2012 $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $sOutput = "" ;- $sOutput &= "Computer: " & $strComputer & @CRLF $sOutput &= "" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $sOutput &= "Computer Status: " & $objItem.Status & @CRLF Next Else Return ("WMI not functional") EndIf $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) ;- If IsObj($colItems) Then ;- For $objItem In $colItems ;- MsgBox(0, "", "SerialNumber" & $objItem.IdentifyingNumber) ;- $sOutput &= "SerialNumber: " & $objItem.IdentifyingNumber & @CRLF ;- Next Return ($sOutput) ;- EndIf EndFunc ;==>_wmigetcompinfo Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2)) EndFunc ;==>WMIDateStringToDate Func OKButton($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body) ;~ $s_AttachFiles = '' $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body, $s_AttachFiles) ProgressOn("Progress", "Submitting your ticket...", "0 percent") For $i = 0 To 100 Step 20 Sleep(500) ProgressSet($i, $i & " percent") Next ProgressSet(100, "Done", "Complete") Sleep(500) ProgressOff() If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) Else SplashTextOn("HelpDesk App", "Your ticket has been submitted successfully", 300, 100) Sleep (2000) SplashOff() ;~ else EndIf EndFunc ;==>OKButton Func OnEmail($sSupportEmail) Run(@ComSpec & " /c " & 'start mailto:' & $sSupportEmail, "", @SW_HIDE) EndFunc ;==>OnEmail Func CLOSEClicked() ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, ;and @GUI_WINHANDLE would equal $hMainwindow Exit EndFunc ;==>CLOSEClicked ; ; The UDF Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $sBody = "", $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 $MyManager <> "" Then ;~ $objEmail.Cc = $MyManager ;~ EndIf If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($sBody, "<") And StringInStr($sBody, ">") Then $objEmail.HTMLBody = $sBody Else $objEmail.Textbody = $sBody & @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 $goMyRet EndIf $objEmail = "" EndFunc ;==>_INetSmtpMailCom ; ; ; Com Error Handler Func MyErrFunc() $HexNumber = Hex($goMyError.number, 8) $goMyRet[0] = $HexNumber $goMyRet = StringStripWS($goMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $goMyError.scriptline & " Description:" & $goMyRet & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc Thanks, Grimm -
Afternoon everyone, I have searched over the past several days, and could find an explanation to my question. I have a script that when run is setup to email the data in a form to a group of people using our exchange server. Most of our servers are 64 bit running 64 bit MS OS, with a few that are still 32 bit (being phased out) running older 32 bit MS OS. The 32 bit compiled version of my script works great, on both the 32 bit and 64 bit version of MS OS, with one exception. On our Exchange server, which is running 64 bit OS, I have to compile the script in x64 in order to get the email function to work. My question is why is this? Why does the compiled script work on every server, whether it is running a 64 bit MS OS or a 32 Bit MS OS, except when it is run on our Exchange server. I can provide part of the script if needed. Thanks in advance. Grimm
-
GuiCtrlCreateInput, GuiCtrlRead, & value
grimmlock replied to Dana's topic in AutoIt GUI Help and Support
Let me know if this is what you are looking for - Opt("trayicondebug", 1) #include <GUIConstantsEx.au3> #Include <EditConstants.au3> $crackflow = 0.05 ; lpm $Form1_1 = GUICreate("Form1", 600, 401) $LabCrackFlow = GUICtrlCreateLabel("Crack Flow", 40, 224) $InCrackFlow = GUICtrlCreateInput($crackflow, 140, 224, 41, 21) $ButStart = GUICtrlCreateButton("Start", 232, 344, 75, 25) $ButExit = GUICtrlCreateButton("Exit", 336, 344, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ButExit Exit Case $ButStart ; added an If Statement that looks at the value in the input box and if it does not contain a 0.X such as just .X then it will reset the data in the input box to have the 0.X value ; X = value in the Input field If Not Stringinstr(GUICtrlRead($InCrackFlow), "0.") Then GUICtrlSetData($InCrackFlow, "0" & GUICtrlRead($InCrackFlow)) ConsoleWrite("If Start = " & GUICtrlRead($InCrackFlow) & @CRLF); test to see if the .X value will re-display a 0.X value Else ConsoleWrite("Else Start = " & GUICtrlRead($InCrackFlow) & @CRLF) ; test else display what is the input field EndIf $flownow = "0.002" $crackflow = GUICtrlRead($InCrackFlow) ; moved from a case to here with the other name = value While ($flownow < $crackflow) ConsoleWrite($flownow & @CRLF) $flownow = $flownow + .01 WEnd ConsoleWrite("Finished " & $flownow & @CRLF) EndSwitch WEnd Take care -
GuiCtrlCreateInput, GuiCtrlRead, & value
grimmlock replied to Dana's topic in AutoIt GUI Help and Support
Quick question Dana, *Edit* Do you know what the correct output from should be from the ConsoleWrite, if a user changes the value from 0.05 to say 0.01? I think I may have a solution but wanted to make sure that I am getting the correct results before I post it. Thanks, Grimm -
Good Morning. I am working on a app that a user can input a value and when Notepad is idle for the set value, the user is notified (MsgBox) and then NotePad is closed. So far when I have notepad open and I set the value in the input box and press the 'set' button it immediately pops the MsgBox and when so when I close the msgbox notepad closes. What I am trying to do is have the value in the input box be value that notepad has to be idle for more than, in order to display the message box, and close notepad, however is notepad becomes in use before the idle time reaches the value in the input box then I want to reset the timer. Any help would be appreciated. #include <GUIConstantsEx.au3> #include <UpDownConstants.au3> #include <Timers.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <Constants.au3> #include <GUIConstants.au3> #NoTrayIcon Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP,"SpecialEvent") ;~ Global $iIdleTime = _Timer_GetIdleTime() ;~ Global $hSet = 0 GUICreate('Seconds', 150, 100, default , default , $ws_popup+$ws_caption) $hLabel1 = GUICtrlCreateLabel('Seconds', 15, 18) $hInput1 = GUICtrlCreateInput('', 65, 15, 65) GUICtrlCreateUpdown($hInput1) $hButton1 = GUICtrlCreateButton('Set', 15, 50, 55) $hButton2 = GUICtrlCreateButton('Cancel', 75, 50, 55) GUISetState() While 1 Switch GUIGetMsg() ;~ Case $GUI_EVENT_CLOSE Case $hButton1 _idletime() Case $hButton2 GUISetState(@SW_HIDE) TraySetState(1) ; hide EndSwitch WEnd Func _idletime() $iIdleTime = _Timer_GetIdleTime() $hSet = GUICtrlRead($hInput1) * 1000 If WinExists('Notepad') And $iIdleTime >= GUICtrlRead($hSet) Then MsgBox(0, '', '$hSet = ' & $hSet & @CRLF & @CRLF & 'Idle time was ' & $iIdleTime) ;~ MsgBox(0, '', 'You have been idle for ' & GUICtrlRead($hInput1) & ' second(s)') Else MsgBox(0, '', @error) EndIf EndFunc Func SpecialEvent() GUISetState(@SW_SHOW) TraySetState(2) ; hide EndFunc Thanks Grimm