write to registry DWORD, how

write to registry DWORD, how

Anonymous
Not applicable
1,254 Views
2 Replies
Message 1 of 3

write to registry DWORD, how

Anonymous
Not applicable

Want to send email via a command but everytiime Outlook throughs a warning. I want to turn this warning off via the registry.

The code below creates REG_SZ but I need DWORD.

 

(defun c:test ()

(vl-registry-write "HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Office\\15.0\\outlook\\security" "AdminSecurityMode" "3")
(vl-registry-write "HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Office\\15.0\\outlook\\security" "PromptOOMSend" "2")
(vl-registry-write "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Office\\15.0\\Outlook\\Security" "ObjectModelGuard" "2")
)

 

I have found this, but it does not work nor do i understand it. (below)

 

(defun c:testing ()
(setq wssh (vlax-create-object "WScript.Shell"))

(vlax-invoke-method wssh 'RegWrite "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Office\\15.0\\Outlook\\Security"
(vlax-make-variant 0 2) "REG_DWORD")

(vlax-release-object wssh)
)

 

Any thoughts

0 Likes
Accepted solutions (1)
1,255 Views
2 Replies
Replies (2)
Message 2 of 3

diagodose2009
Collaborator
Collaborator
Already we develope converter registry to visual -lisp. If you are programmer,then i can insert your-sources in our-project.. Please you contact us at link-bellow
Message 3 of 3

Anonymous
Not applicable
Accepted solution

Here is a snipet from the finished working code. This was part of a larger "if" statement for turning off the outlook security warning when sending an email via the lisp.

 

 

(progn
;;;turn msoutlook warning off
(alert "Your Outlook settings must be updated. The system will Close Outlook and reopen it now. This is a one time setup operation.")
(vl-registry-write "HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Office\\15.0\\outlook\\security" "PromptOOMSend" 2)
(vl-registry-write "HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\Office\\15.0\\outlook\\security" "AdminSecurityMode" 3)
(vl-registry-write "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Office\\15.0\\Outlook\\Security" "ObjectModelGuard" 2)
;;;end regedit

;;;close and reopen outlook with batch operation
(command "shell" "\\\\cporldata\\trust\\Software\\Batch\\Closerestartoutlook.bat")

;;;end

;;;get date and time then write to log file
(setq mooddate (menucmd "m=$(edtime,$(getvar,DATE),MO/DD/YY)"))
(setq moodtime (menucmd "m=$(edtime,$(getvar,DATE),HH:MM:SS)"))
(setq combine (strcat mooddate "," moodtime "," "Help"))
(setq f (open "\\\\cporldata\\Antikythera\\MoraleLog.csv" "a"))
(write-line combine f)
(close f)

;;;end

;;;send email
(setq olApp (vlax-get-or-create-object "Outlook.Application"))
(setq objMail (vlax-invoke olApp 'CreateItem 0))
(vlax-put-property objMail 'Subject "my subject")
(vlax-put-property objMail 'To "email@address")
(vlax-put-property objMail 'Body "message body.")
(vlax-invoke objMail 'Send)
;;;end if not
)

0 Likes