View Single Post
  #4  
Old 05-13-2023, 02:23 AM
Spliff Spliff is offline
Registered User
 
Join Date: 04-07-2021
Posts: 207
Could you please help me with this? I obviously don't fully understand your explanations above.

I want link from db "0" to a target item in db "y", the target item has the UR path

So, I "copy" the "y" db path (which is d:\ur\y.db) into db "0", and this creates, in "0" a new item, with title "y.db", and with URL "y.db"; in the content pane, there is a link, "Click here to open linked document".

Then, I replace the URL with the target item's path from the UR command-line, and which is (in there) d:\ur\y.db, 9186,1000 (the "id" path being constructed bottom-up, with "1000" as the db tree's source item) - this gives an error message, "System cannot find the file", so I try with \ instead of /, and with file://... before the link, and similar, but to no avail. Thus:

1) What is the exact format for the link in the URL attribute? (My forum search for "URL" didn't bring any result.)

2) Independently of that, would there be a link format, e.g. similar to "file://file_system_path/x.urd/internal_ur_path", which could be used directly from the tree?

3) Similar to 2), but independently of it (i.e. perhaps 3) is possible whilst 2) is not?): Would there be a link format in the form
"c:\ultrarecall_path\ultrarecall.exe" "ur_file_path_and_name/internal_ur_path"
which then could be triggered by a "run" or similar command from the command window or other third-party applications, and which would enable them to open / activate a specific UR db, displaying a specific item?

It's obvious that 3) would be a fantastic tool then for project management (PM) of all sorts, for many possible users who need "real" PM tools, but who want to use UR as an absolutely stable data for masses of data, or even just to have quick access to their data, in UR, from their lightweight "ToDo" / calendar app or similar!


EDIT:

Help in the help subject "Command-line syntax".

You ONLY need the itemID, NOT the internal-path (which had been my error above).

You might create, in AHK e.g., and in order to go from e.g. the "y9186" link item in your current UR db 0.db, to the target item 9186 in your target UR db "y", and understood you would trigger control-enter when the 0.db "y9186" item is selected in the 0.db tree:

$^enter:: ; control-enter
if winactive("ahk")
ur_display()
; else if ...
else
sendevent, ^{enter}
return

Then both the following scriptlets work fine, and our example "y9186" will bring the message-output
_"C:\Program Files\UltraRecall\UltraRecall.exe" "d:\ur\y.db" /item 9186_

This for 1-char UR db names (as mine) only:
ur_display()
{
clipboard := ""
path := ""
item := ""
s := ""
sendevent, +^i ; "Item-CopyCommandLine"
clipwait, 3
pos := instr(clipboard, "|",, 0) ; last occ
path := "d:\ur" . substr(clipboard, pos+1, 1) . ".db"
item := " /item " . substr(clipboard, pos+2)
s := """C:\Program Files\UltraRecall\UltraRecall.exe"" """ . path . """" . item
; msgbox, _%s%_ ; see above
run, %s% ; (loads in case, and activates)
}

But since that's not realistic for most users, see (for longer UR db names but not containing digits):
ur_display()
{
clipboard := ""
s := ""
path := ""
item := ""
sendevent, +^i ; "Item-CopyCommandLine"
clipwait, 3
pos := instr(clipboard, "|",, 0) ; last occ
s := substr(clipboard, pos+1)
loop, parse, s
{
if a_loopfield is digit
item .= a_loopfield
else if ( a_loopfield = "." )
continue
else
path .= a_loopfield
}
path := "d:\ur" . path . ".db"
item := " /item " . item
s := """C:\Program Files\UltraRecall\UltraRecall.exe"" """ . path . """" . item
; msgbox, _%s%_ ; see above
run, %s% ; as above
}

Now these are for triggering the link from within UR, but it's obvious that you can, with minimal adjustments, trigger any UR item from ANYWHERE, from any possible "app" on your computer; you can also adjust the "TargetfilenameTargetitemnumber" schema according to your liking, e.g. put a leading dot before the naming string, and/or between the name and the number (for that, I added the necessary code to the second scriptlet), or whatever.

Copyright by Spliff in UltraRecall forum, i.e. citations with source in case.


SECOND EDIT:

Well, in practical use now I have to admit that whilst my links work fine, technically, I don't have the slightest idea to what target the lead, hahaha! Thus, let's adopt a link schema as follows (you obviously can then adapt that schema to your liking, it just must be consistent):

.targetdbname.targetitemname (targetitemid)
e.g.: .y.name of the target item (9186)
= last clipboard-element (=item-title): |.y.name of the target item (9186)

then:

ur_display()
{
clipboard := ""
s := ""
path := ""
item := ""
sendevent, +^i ; "Item-CopyCommandLine"
clipwait, 3
pos := instr(clipboard, "|",, 0) ; last occ
if ( substr(clipboard, pos+1, 1) != "." )
{
msgbox, The item is not a link. Aborted.
exit
}
clipboard := substr(clipboard, pos+2) ; without the leading "|."
pos := instr(clipboard, ".") ; first occ (db (!) names without dots only!)
; we delete the divider-dot and then add the suffix-dot, but you
; might use another divider, so this makes sense indeed:
path := "d:\ur" . substr(clipboard, 1, pos-1) . ".db"

pos := instr(clipboard, "(",, 0) ; last occ
item := " /item " . substr(clipboard, pos+1, strlen(item)-1) ; without the trailing ")"
s := """C:\Program Files\UltraRecall\UltraRecall.exe"" """ . path . """" . item
; msgbox, _%s%_ ; see above
run, %s%
}

Please note that the "title" part of the link item does not need to be identical with the item title of the target item... and that obviously, you can also automate the creation of the link (by analyzing the clipboard output of the target item (similar to what we did here with the link item), in order to get target db path/name, its original item title, and its ID (while we retrieve those here manually / visually from the Item Attributes field of the target item), not only, as given here, the link follow. Copyright as above.

Last edited by Spliff; 05-13-2023 at 08:46 AM.
Reply With Quote