Rule runs manually but returns the error code "an unexpected error has occurred" when incoming mail arrives - rules

Microsoft 365 V2205, build 15225.20204
The following VBA macro used to work, and it still works when run manually. A couple of years ago, I am guessing that a change from Microsoft occurred, and it now returns the error code "an unexpected error has occurred" when Outlook automatically runs it. Can someone show me a fix for the rule/VBA that will allow the rule/VBA to:
On an incoming email
Mark it as high importance
Update the subject
Set a category “Bill”
Set a reminder
Here is the:
Rules description
Apply this rule after the message arrives
With ‘Your credit card statement is ready’ or ‘Your statement is ready for credit card ending’
And on this computer only
Mark it as high importance
And run Damian.PendingPaid1
Here is the VBA:
Sub PendingPaid1(Item As Outlook.MailItem)
Item.Categories = "Bill"
Item.Subject = Item.Subject & " " & Chr(150) & " Pending " & Chr(150) & " PAID " & Chr(150) & " 220"
Item.ReminderSet = True
Item.FlagDueBy = Date + 1 & Space(1) & "8:45 AM" ' Remind 1 day from now.
Item.ReminderTime = Date + 1 & Space(1) & "8:45 AM" ' Remind 1 day from now.
Item.Save
End Sub

Related

Conditional formatting for dates in Crystal Reports

Relatively new to Crystal Reports. I'm trying to get a date to populate normally if it is after today's date, but with a leading and following asterisk if it's prior to today's date.
What I tried:
if {V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}>CurrentDate then {V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}
else "* " &({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}) & " *"
When I check the formula I receive "A date-time is required here" error relating to:
"* " &({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}) & " *"
Little help for a newbie? (Also, yes, I realize "availability" is spelled incorrectly.)
I was missing was the date formatting for the else statement:
if {V_ORD_AVALIABILITY.MUST_SHIP_DATE} = DATE(0000,00,00)
then " "
else (if {V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE} <= CurrentDate
then totext({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}, "* M/d/yy *")
else totext({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}, "M/dd/yy")}

AutoIT: ADODB.Connection method 'open' missing?

I want to use AutoIT to access a Maria DB via ADODB objects.
The creation of the ADODB.Connection object seems to work properly. But for some reason I cannot find, the open method fails. I am no AutoIT expert, but to me it does not look like the object had problems with the arguments.
The relevant lines of the code are:
$objConn = ObjCreate("ADODB.Connection")
ConsoleWrite("ADODB conn Error: " & #error & " - Typ: " & VarGetType($objConn) & #crlf)
$objConn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword)
ConsoleWrite("conn Error: " & #error & #crlf)
The second ConsoleWrite is not reached. The Output and error-message are:
ADODB conn Error: 0 - Typ: Object
"C:\Users\mischneider\Documents\Automation_Base\udf\mysql.au3" (29) : ==> The requested action with this object has failed.:
$objConn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" &
$sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword) $objConn^ ERROR
Can anyone tell what I'm doing wrong and how I can open the connection?
Many thanks in advance,
Michael
I found the reason of and could resolve the problem.
My custom function took $sDriver with following (wrong) default value:
[...]$sDriver = "(MySQL ODBC 3.51 Driver)", [...]
where parentheses () instead of braces {} were used. Correct is:
[...]$sDriver = "{MySQL ODBC 3.51 Driver}", [...]
The laptop screen is so small I didn't realize that. But inserting a working Connection string and then comparing it to the result of the concatenation char by char, I recognized the difference.
I hope this now documented accident will help others in my situation.
BR
Michael

Autoit get current caret position Or current text box position

So i am working on a project and i got stuck on this part.
I am trying to locate the position of ether the typing caret(The blinking line while typing) or the current text box that is being typed in.
The main part that is hard is i am looking to do this for every input on my computer (Firefox search, Notepad, Renaming files, writing this post...)
I am beginning to doubt that auto-it can do this, i am open to using another language that can do this. (I have not checked any other language but Auto-it yet)
I have tested "WinGetCaretPos()" and a few other random scripts, but they had the same problem, they don't return the correct position.
~Thanks
Not all controls are standard window controls that can be accessed with AutoIt functions. Many programs (especially browsers) have nonstandard controls so "every input" on the computer might be hard to get.
Here is an example of how to get the control information of any active window that is giving focus to a control AND has standard windows controls.
HotKeySet("{ESC}", "Terminate")
While 1
Sleep(500)
GetControlFocus()
WEnd
Func GetControlFocus()
Local $hWinHandle = WinGetHandle("[Active]")
Local $sControl = ControlGetFocus($hWinHandle)
Local $sText = "The active window handle is: " & $hWinHandle & #CRLF
If $sControl <> "" Then
$sText &= "The control with focus in the active window is: " & $sControl & #CRLF
Local $aPos = ControlGetPos($hWinHandle, "", $sControl)
$sText &= "Mouse position: X: " & $aPos[0] & " Y: " & $aPos[1] & #CRLF & "Size: " & $aPos[2] & ", " & $aPos[3]
Else
$sText &= "The active window is not giving focus to a control that AutoIt recognizes."
EndIf
ToolTip($sText, 0, 0)
EndFunc ;==>GetControlFocus
Func Terminate()
Exit
EndFunc ;==>Terminate
You can get the control position of other programs using IUIAutomation and this UDF. But it would not be as simple as using a few standard AutoIt functions.

When comparing two identical strings they return as different

I have the first password from a text box:
pwtextbox = TextBox2.Text
and the other one I am reading from a DB Table:
pwdatabase = SQLdr("pw")
I've tried to compare them using '=', StrComp, and strings.compare and they always, no matter what, come as different
While SQLdr.Read() 'While Data is Present
pwdatabase = SQLdr("pw") 'pwdatabase is equal db entry
Response.Write(pwtextbox & "=" & pwdatabase & "?<br>") 'is mickey=mickey?
If StrComp(pwtextbox, pwdatabase) = 0 Then
Response.Write("login successful")
Response.Write(pwdatabase & "is the pass")
Else
Response.Write("wrong password. ")
Response.Write(TextBox2.Text & " is the wrong pass. the right password is " & pwdatabase)
End If
End While
the onscreen display outputs as follow:
mickey=mickey?
wrong password.
mickey is the wrong password. the right password is mickey.
I can't seem to understand!
especially when I see on the screen that the two strings are identical, I still get this false positive...
can you see what I'm missing?

Classic ASP Array not returning values, error 500

I'm working on executing the same code several times to produce a table. My first thoughts went out to using an array to do this.
Here is what i have got so far:
Dim iRow
iRow = 0
'alternate color for rows
Do While Not rsGlobalWeb.EOF
If iRow Mod 2 = 0 Then
response.write "<tr bgcolor=""#FFFFFF"">"
Else
response.write "<tr bgcolor=""#EEEEEE"">"
End If
'some other code
SqlBackup = "SELECT * FROM CMDBbackup WHERE Naam_Cattools = '" & rsGlobalWeb("Device_name") & "'"
Set rsBackup = Server.CreateObject("ADODB.Recordset")
rsBackup.Open SqlBackup, dbGlobalWeb, 3
'declaration of array
Dim fieldname(5),i
fieldname(0) = "Device_name"
fieldname(1) = "Image"
fieldname(2) = "Backup"
fieldname(3) = "Uptime"
fieldname(4) = "Processor"
fieldname(5) = "Nvram"
For i = 0 to 5
If rsGlobalWeb(fieldname(i)) <> "" Then
response.write("<td>" & rsGlobalWeb(fieldname(i)) & "</td>")
Else
If Not rsBackup.EOF Then
If Not IsNull(rsBackup(fieldname(i))) And (rsBackup(fieldname(i)) <> "") Then
response.write("<td>" & rsBackup(fieldname(i)) & " (backup)</td>")
End if
Else
response.write("<td>No data found</td>")
End if
End if
Next
response.write("</tr>")
iRow = iRow + 1
rsGlobalWeb.MoveNext
Loop
The issue i have now is that the following error occurs even tho i have friendly messages turned off:
"500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed."
The logfile shows the following:
"DaEngineSDB.asp |58|800a000d|Type_mismatch 80 -" Where the 58 is the line with the Dim Fieldname.
Without the array it does show the remainder of the code (i have 1 other field which gets added). If i remove the array and fill the fieldname(i) with a normal string value it also works fine.
I was trying out stuff that google says but after attempting several things i am still running up to a wall.
Any ideas what it could be?
Thanks in advance,
Erik
First you should turn on error displaying in your iis, or read the error log for its description, google it if not sure how.
Without error description, it's way too difficult to check what is wrong.
Problem solved!
After banging my head against the wall for a day i found out that i stupidly declared the array inside the DO WHILE loop. Moved the declaration out of it and problem solved.

Resources