Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   Realm Works Discussion (http://forums.wolflair.com/forumdisplay.php?f=67)
-   -   Multiple Topic Entry Workaround (http://forums.wolflair.com/showthread.php?t=56737)

Kathorus October 8th, 2016 06:15 AM

Multiple Topic Entry Workaround
 
One of the methods of data entry that is suggested for Realm Works is to put in the "Skeleton" of the data so that linking is enabled from the get-go. This could be a lot of clicking for a deep topic, such as spells from the 5e SRD, cities from a world, monsters, weapons, etc.... I still don't think there's a method for add multiple topics at once in the program, so I hacked this together, which basically takes a list of things from one place and makes them a list of topics in Realm Works.

First, the main workhorse for this is AutoHotKeys, which is a robust scripting program that I'm using to handle Windows. (if you're not familiar with it, I suggest reading through the extensive help file)
Second, you need a text editor that has macro ability, I use Notepad++. (again, if you're unfamiliar with the macro functionality, it pays to look it over)
And, of course, Realm Works.

Part 1 - Data prep and macro creation
We need a list of spells, I found an excel sheet with the spell names and pasted those into Notepad++, the important thing is that each topic you wish to create should be on one line in the file.

Next, I created a macro in Notepad++ that does;
'bring me to the top - Ctrl+Home
'select my first line - Shift+End
'cut me to the clipboard - Shift+Delete
'remove my empty line - Delete

I save this marco and give it a keystroke combination.

Part 2 - AutoHotKeys
We need to be able to go to Notepad++, run our macro on our spell list and then go into Realm Works, create a new Topic, paste the spell from the clipboard

First, create a script as explained in AutoHotKeys documentation
Next, Paste this in (the number next to Loop is the number of items in your list)
Code:

Loop, 10 {
                WinActivate, ahk_exe notepad++.exe ; Activate Notepad++ instance
                WinWaitActive, ahk_exe notepad++.exe ; Wait until Notepad++ is active
                Send !^+C ; Send Keystroke for Macro
                Sleep, 1000 ; Sleep for a second                       
                WinActivate, ahk_exe RealmWorks.exe ; Activate RealmWorks
                WinWaitActive, ahk_exe RealmWorks.exe ; Wait until RealmWorks is active
                Send ^q^v{Enter} ; Keystrokes to Create Topic, Paste Clipboard, Save Topic
                Sleep, 1000 ; Sleep for a second
        }

Part 3 - Setup
The script assumes both Notepad++ and Realm Works are open.
In Notepad++, your list should be on the tab with focus.
In Realm Works, you should manually go in and create a new topic under the category you're adding to so that future visits for the script are pointing at the correct category.
Set the number in the Loop to the number of items in your list (I would test a few, prior to running a large list).
Right-Click the script and "Run Script".
Wait a few minutes.

Hope this can be of some use to folks. I can try to answer questions about it, but stuff like this I typically throw together quickly by trial and error.

AEIOU October 8th, 2016 08:25 AM

Oh, to be able to parse a spreadsheet or comma delimited file to fill in multiple sections quickly.... Maybe someday.

In the meantime, this is a great step in the right direction. Thank you for the step-by-step. Very useful!

Kathorus October 9th, 2016 03:11 AM

It looks highly possible to be able to set up scripts that would enter all the data into a topic, but you'd have to know exact keystrokes and have the data formatted, it'd be very tedious to setup.

MNBlockHead October 9th, 2016 09:24 PM

Nice! I use PhraseExpress to automate a number of things in RW and to create keyboard shortcuts where none exist. I have done anything like this yet. Might be nice for Monster lists. Thanks for the walkthrough!

Kathorus October 10th, 2016 06:18 AM

Yeah, I used it for entering spells and monsters from text lists from the 5e SRD, so about 800 items, took about 20 minutes. Part of that time is that I have sleep steps between application changes and that gives it time to catch up, without those, the script was copy/pasting quicker than the switch, I choose a second, but didn't test anything quicker and it might work with a smaller interval.

For in application stuff, I have a Logitech G15 that I program keystrokes into for highly repetitive tasks or to setup hotkeys.

Exmortis October 10th, 2016 01:43 PM

Quote:

Originally Posted by Kathorus (Post 235858)
One of the methods of data entry that is suggested for Realm Works is to put in the "Skeleton" of the data so that linking is enabled from the get-go. This could be a lot of clicking for a deep topic, such as spells from the 5e SRD, cities from a world, monsters, weapons, etc.... I still don't think there's a method for add multiple topics at once in the program, so I hacked this together, which basically takes a list of things from one place and makes them a list of topics in Realm Works.

First, the main workhorse for this is AutoHotKeys, which is a robust scripting program that I'm using to handle Windows. (if you're not familiar with it, I suggest reading through the extensive help file)
Second, you need a text editor that has macro ability, I use Notepad++. (again, if you're unfamiliar with the macro functionality, it pays to look it over)
And, of course, Realm Works.

Part 1 - Data prep and macro creation
We need a list of spells, I found an excel sheet with the spell names and pasted those into Notepad++, the important thing is that each topic you wish to create should be on one line in the file.

Next, I created a macro in Notepad++ that does;
'bring me to the top - Ctrl+Home
'select my first line - Shift+End
'cut me to the clipboard - Shift+Delete
'remove my empty line - Delete

I save this marco and give it a keystroke combination.

Part 2 - AutoHotKeys
We need to be able to go to Notepad++, run our macro on our spell list and then go into Realm Works, create a new Topic, paste the spell from the clipboard

First, create a script as explained in AutoHotKeys documentation
Next, Paste this in (the number next to Loop is the number of items in your list)
Code:

Loop, 10 {
                WinActivate, ahk_exe notepad++.exe ; Activate Notepad++ instance
                WinWaitActive, ahk_exe notepad++.exe ; Wait until Notepad++ is active
                Send !^+C ; Send Keystroke for Macro
                Sleep, 1000 ; Sleep for a second                       
                WinActivate, ahk_exe RealmWorks.exe ; Activate RealmWorks
                WinWaitActive, ahk_exe RealmWorks.exe ; Wait until RealmWorks is active
                Send ^q^v{Enter} ; Keystrokes to Create Topic, Paste Clipboard, Save Topic
                Sleep, 1000 ; Sleep for a second
        }

Part 3 - Setup
The script assumes both Notepad++ and Realm Works are open.
In Notepad++, your list should be on the tab with focus.
In Realm Works, you should manually go in and create a new topic under the category you're adding to so that future visits for the script are pointing at the correct category.
Set the number in the Loop to the number of items in your list (I would test a few, prior to running a large list).
Right-Click the script and "Run Script".
Wait a few minutes.

Hope this can be of some use to folks. I can try to answer questions about it, but stuff like this I typically throw together quickly by trial and error.

WOW are you kidding me?

That's awesome!

Zaphod Beebledoc October 10th, 2016 03:28 PM

Would you be able to create a bunch of Tags do you think?

Kathorus October 10th, 2016 03:54 PM

Yeah, it'd be similar, once the tag is open go back into the list, copying the next item, return to Realm Works, paste, determine the keystrokes to hit the "add" button. With a little messing around might even be able to script multiple tag lists. Sounds useful to me already, I'll poke around today or tomorrow and see what's quickly possible.

Kathorus October 10th, 2016 06:21 PM

Or, AutoHotKeys seems to be very well designed. I was able to setup a simple text file with a list of items. I then went into Realm Works made a new Tag group, Clicked the "add tag" button and run the following script, it will bring focus back to Realm Works and process through the list.
Code:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

WinActivate, ahk_exe RealmWorks.exe ; Activate RealmWorks
WinWaitActive, ahk_exe RealmWorks.exe ; Wait until RealmWorks is active
Loop, Read, Sample.txt ; Sample.txt needs to be in the directory that the script runs from.
{
        clipboard = %A_LoopReadLine% ; load the current line into the window's clipboard
        Send ^v {Return}        ; paste the contents of the clipboard into the testbox and press Enter
}


Which means that a similar script could be created for the topics, there is also some built in parsing in AutoHotKeys that would allow delimited files to be used to enter snippets into the topics, but you'd have to have that planned out well.

Kathorus October 11th, 2016 04:57 AM

Quote:

Originally Posted by Exmortis (Post 235987)
WOW are you kidding me?

That's awesome!

Glad you like it.


All times are GMT -8. The time now is 12:34 PM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.