B4J Library jShortcut

This is a wrapper for this Github project. The jni involved is included in the lib download. Copy the content to the b4j additional libs folder.

The aim of the library is to create shelllinks on windows.

jShortcut
Author:
DonManfred (wrapper)
Version: 1
  • ShellLink
    Methods:
    • Initialize (destpath As String, linkName As String, target As String)
    • Initialize2 (destpath As String, linkName As String, target As String, cmdArgs As String, desciption As String)
    • Initialize3
    • IsInitialized As Boolean
    • getSystemDirecory (dirtype As String) As String
      Get the Pat of a Systemdirectory.
      Possible values for dirtype are:
      - "desktop"
      - "programs"
      - "program_files"
      - "common_programs"
      - "common_desktopdirectory"
      - "personal"
    • save
      Save the Shelllink
    Properties:
    • Arguments As String [write only]
      Defined the commandline-args for the shelllink.
    • Description As String [write only]
      Set the description for the shelllink
    • DestinationPath As String [write only]
      Set the path where the link will be created
    • IconIndex As Int [write only]
      Set the Iconindex in the iconlib defined with
      setIconLocation.
    • IconLocation As String [write only]
      Define the Iconlib location.
      For example "%SystemRoot%\\system32\\SHELL32.dll"
      Use setIconIndex to set a Icon from this iconlib
    • Name As String [write only]
      Set the name for the shelllink
    • Target As String [write only]
      Set the Target for the shelllink
      Usually it is the Path to an program. Or an url
    • WorkingDirectory As String [write only]
      Set the workingdiectory for the target to be executed in

B4X:
    Private msLinks As ShellLink
    msLinks.Initialize3
    msLinks.IconLocation = "%SystemRoot%\system32\SHELL32.dll"
    msLinks.IconIndex = 21
    msLinks.WorkingDirectory = "G:\"
    msLinks.Arguments = "--help --option1=x"
    msLinks.Description = "Description bla bla bla"
    msLinks.DestinationPath = msLinks.getSystemDirecory("desktop")
    msLinks.Name = "B4J Shelllink"
    msLinks.Target = "https://www.b4x.com/android/forum/threads/create-windows-shortcut.62377/" '"G:\32527-116921.pdf"
    msLinks.save

If you want to donate for my work building the wrapper you can do it here:

Attached:
- Example
- Library files for b4j
- Java source of the wrapper
 

Attachments

  • jShortcutEx.zip
    1 KB · Views: 593
  • libjShortcutV1.0.0.zip
    134.3 KB · Views: 670
  • jShortcutJAVA.zip
    133.6 KB · Views: 620
Last edited:

Peter Simpson

Expert
Licensed User
Longtime User
Now this sounds Interesting @DonManfred, I will be giving this a blast later :cool:
 
Top