Automate Logos (Notes) with Powershell

Note Automation
Creating Notes from a Template could be useful in some situations. I created this powershell solution to do just that. I tried to keep the implementation as simple as possible.
- Download and extract all files in AutoNotes.zip file to one directory
- Drag the "Sample Template.vbs" into Logos to create a Button on the ToolBar
- Create an empty Note Document
- Make sure the Active Panel is the Note you created
- Click the Button you created
- It will create 7 Notes from the Template
This is what the sample script will generate:
Your own Template
To create your own template:
- Make a copy of "Template1.ps1" and save it with any name
- Edit the content of the new file
- Make a copy of "Sample Template.vbs" and save with a new name
- Change the "tmp" variable to point to the copy of "Template1.ps1" file you modified
- Drag and drop the vbscript file to create a button in Logos
- Create an empty Note Document
- Make sure it's the Active Panel
- Click the Button you created
System
- Win 10
- Powershell 5 (10586)
- Logos Bible Software 6.8 (6.8.0.0049)
Notes
I used Keyboard shortcuts to Toggle Bold, so please do not do anything until the template is complete. I'm investigating to use TogglePattern.Pattern.Invoke on all buttons in the Notes Panel.
The syntax for Template creation is in the "Template1.ps1" file.
Enjoy - and please inform me of any bugs
Comments
-
Excellent!
Orthodox Bishop Alfeyev: "To be a theologian means to have experience of a personal encounter with God through prayer and worship."; Orthodox proverb: "We know where the Church is, we do not know where it is not."
0 -
Does anyone know how to add EventHandlers for LogosComApi in Powershell? I know I'm missing something: $this.ComApplication holds the Launcher.Application object.
Register-ObjectEvent -InputObject $this.ComApplication -EventName PanelActivated -Action {
Out-Host "<PanelActivated>"
}I want to improve the Note script to do much more. Behind the scenes of the sample script is much more power (I'll add the complete version later). You can automate almost anything like with AutoIt, just a lot easier, right in PowerShell.
Sample:
$Logos = [Logos]::new()
With ($Logos.Home){
.Show($)
.Customize.Show().Select("Start Prayer List")
}
With ($Logos.CommandBox){.SetText("Close All")
.Execute($)}
$Logos.Search.Invoke()
$Logos.Panels.Select(0)
With ($Logos.Panels.Automation){
.SearchBasic($)
.SearchText("Paul")
.Search($)
}
The idea is to make use of PowerShell as an easy MacroEditor. Here is a preview of the MacroEngine.
NB: The Withblock is a custom function, always pass a ($) and not empty brackets (), otherwise the script will crash.
0 -
Chrome blocks as malicious file. Help
Meanwhile, Jesus kept on growing wiser and more mature, and in favor with God and his fellow man.
International Standard Version. (2011). (Lk 2:52). Yorba Linda, CA: ISV Foundation.
MacBook Pro MacOS Sequoia 15.3 1TB SSD
0 -
Does it block the download or the script from execution?
0 -
the download
Meanwhile, Jesus kept on growing wiser and more mature, and in favor with God and his fellow man.
International Standard Version. (2011). (Lk 2:52). Yorba Linda, CA: ISV Foundation.
MacBook Pro MacOS Sequoia 15.3 1TB SSD
0 -
AutoNotes.Zip
AutoNotes.ps1
#Logos Bible Software Note Automation
#Created : Des 2015
#Developer: PJ Kotze
$AssemblyPath = "$env:programfiles\Reference Assemblies\Microsoft\Framework\v3.0"
[void][System.Reflection.Assembly]::LoadWithPartialName("UIAutomationClient")
[void][System.Reflection.Assembly]::LoadWithPartialName("UIAutomationTypes")
add-type -AssemblyName System.Windows.Forms
[Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null
$DebugViewWindow_TypeDef = @'
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string ClassName, string Title);
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
public static extern bool SetCursorPos(int X, int Y);
[DllImport("user32.dll")]
public static extern bool GetCursorPos(out System.Drawing.Point pt);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
public static void LeftClick(){
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
public static void RightClick(){
mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
}
Add-Type -MemberDefinition $DebugViewWindow_TypeDef -Namespace AutoClicker -Name Temp -ReferencedAssemblies System.Drawing
#=========================================
# FUNCTIONS
#=========================================
Function GetLogosWindow
{
#Get Logos Window
$AppCon = New-Object Windows.Automation.PropertyCondition([Windows.Automation.AutomationElement]::NameProperty, "Logos Bible Software")
$ClassCon = New-Object Windows.Automation.PropertyCondition([Windows.Automation.AutomationElement]::ClassNameProperty, "Window")
$AndCon = New-Object Windows.Automation.AndCondition($AppCon, $ClassCon)
return [Windows.Automation.AutomationElement]$Desktop.FindFirst([Windows.Automation.TreeScope]::Descendants, $AndCon)
}
Function GetNotePanel($Title){
$TabCon = New-Object Windows.Automation.PropertyCondition([Windows.Automation.AutomationElement]::NameProperty, $Title)
$ClassCon = New-Object Windows.Automation.PropertyCondition([Windows.Automation.AutomationElement]::ClassNameProperty, "TabItem")
$AndCon = New-Object Windows.Automation.AndCondition($TabCon, $ClassCon)
return [Windows.Automation.AutomationElement]$Logos.FindFirst([Windows.Automation.TreeScope]::Descendants, $AndCon)
}
Function GetDesktopWindow
{
return [Windows.Automation.AutomationElement]::RootElement
}
Function GetAddNote
{
$con = New-Object Windows.Automation.PropertyCondition([Windows.Automation.AutomationElement]::NameProperty, "Add note")
$btn