Go to documentation repository
Page History
...
By macro 1, send a message with the attached files detected.png and found.jpg from the folder C:\\Pictures\\ to example@gmail.com. The message should be formatted as follows:
Face detected
Detected face | Face in DB |
detected.png file | found.jpg file |
Code Block |
---|
if(Event.SourceType == "MACRO" && Event.SourceId=="1" &&Event.Action=="RUN") { var file1 = "detected.png"; var file2 = "found.jpg"; var file_folder = "C:\\Pictures\\"; var test_event = CreateMsg(); test_event.StringToMsg("MAIL_MESSAGE|1|SEND_RAW|cc<>,to<danil@itv.ru>,objname<Mail message 1>,subject<>,parent_id<1>,flags<>,pack<>,name<Mail message 1>,from<example@gmail.com>,_marker<>"); test_event.SetParam("body","<html><body>\r\n<h3>Face found</h3>\r\n<table><tr>\r\n<td>Detected</td><td>Found in DB</td>\r\n</tr><tr>\r\n<td><img width='200' alt='image1' src='cid:" + file1 + "'/></td>\r\n<td><img width='200' alt='image2' src='cid:" + file2 + "'/></td>\r\n</tr><tr>\r\n<td>E-mail sent from Intellect</td>\r\n</tr></table>\r\n</body></html>"); test_event.SetParam("attachments",file_folder+file1+";" + file_folder+file2); test_event.SetParam("is_body_html", 1); DoReact(test_event); } |
Example 10. Creating test users
Using macro 101, create 50 users in Intellect with IDs from 100 to 150, assigning them an access level with ID 1 (provided that the AL is assigned to the department to which the users are added and users inherit the department AL) and linking an access card with a number, equal to the user ID. The card number must be in HEX format. The department should have no more than 30 users (to speed up the adding process).
Info | ||
---|---|---|
| ||
For more information on access levels and access cards, see the ACFA-Intellect documentation in the AxxonSoft documentation repository. If an ACS integration is configured in Intellect, which supports dynamic user recording, then the created user will be automatically written to the ACS controller when the CORE||UPDATE_OBJECT|objtype<PERSON> event is sent. If dynamics is not supported, then recording users to the controller will need to be initiated manually. |
Code Block |
---|
dep=10; // department ID
start=100;// first user ID
last=150; // last user ID
acc_lev=1; // access level ID
dep_count=30; // max number of users in the department
if( Event.SourceType == "MACRO" && Event.Action == "RUN" && Event.SourceId=="101")
{
kol=0;
card_count=0;
NotifyEventStr("CORE","","UPDATE_OBJECT","objtype<DEPARTMENT>,objid<"+dep+">");
for (i=start;i<=last;i++)
{
kol++;
card_count++;
card=decToHex(card_count);
if (card[card.length-1]==0)
{
card_count++;
card=decToHex(card_count);
}
if (kol==dep_count)
{
NotifyEventStr("CORE","","UPDATE_OBJECT", "objtype<PERSON>,objid<"+i+">,name<user"+i+">,parent_id<"+dep+">, level_id<"+acc_lev+">, facility_code<0>, card<"+card+">");
kol=0;
dep++;
NotifyEventStr("CORE","","UPDATE_OBJECT","objtype<DEPARTMENT>,objid<"+dep+">");
}
else
{
NotifyEventStr("CORE","","UPDATE_OBJECT", "objtype<PERSON>,objid<"+i+">,name<user"+i+">,parent_id<"+dep+">,level_id<"+acc_lev+">, facility_code<0>,card<"+card+">");
}
Sleep(10);
}
}
function decToHex(n)
{
return Number(n).toString(16);
} |