Jump to content

[LE] Executing commands given from external program


Recommended Posts

Hi, I need a way to communicate a set of commands from my external program to Skyrim without any dependencies other than SKSE.

 

Currently, my only idea is to use papyrus to open the console without showing it or pausing the game, then execute the bat file and close the "invisible" console. The problem is that I don't know how to do that and I haven't been able to find any way to do it.

 

I'm using C# for the program though I doubt that matters much.

Link to comment
Share on other sites

  • 2 weeks later...

Hi, I need a way to communicate a set of commands from my external program to Skyrim without any dependencies other than SKSE.

 

Currently, my only idea is to use papyrus to open the console without showing it or pausing the game, then execute the bat file and close the "invisible" console. The problem is that I don't know how to do that and I haven't been able to find any way to do it.

 

I'm using C# for the program though I doubt that matters much.

I've never done this myself, but in theory, I guess you could have your external program write a JSON file, and then use Papyrus Utilities to read that file in game. Best of luck!

Link to comment
Share on other sites

Pretty sure this kind of thing is difficult because it presents a security issue

 

 

#include <windows.h>

 

HWND SkyrimWindow = FindWindowA( "Skyrim", NULL );

 

SendMessage( SkyrimWindow, WM_CLOSE );

 

And Skyrim is running but Skyrim Window is closed <Trollface>

 

 

 

If You want to Execute BAT Programs i think You can do that with ConsoleUtil...

Or maybe not... i dont see Function to call BAT hmm...

 

https://github.com/Ryan-rsm-McKenzie/ConsoleUtilSSE/blob/master/scripts/source/ConsoleUtil.psc

 

Maybe PapyrusUtil... or u can just create Your own DLL... thats always Option ^_^

I don't have PapyrusUtil installed now and im too lazy to Google after i googled for ConsoleUtil...

 

but im 97.31% sure that there is already DLL that allows You to call BAT Programs that are in Skyrim Main Folder

because i was using that long time ago... but i used it once and then never again... and i dont remember name :x...

 

 

 

 

But i dont understand You about C# and "External program"

BAT are not programs, they are Text files...

 

Windows Console is reading Text and interpreting it... so its Text Interpreter

its NOT CODE interpreter, so BAT files are still Text files

 

Bat.Bat

<File name> . <File Extension >

File name tells how to call file

File extension tell how to understand file

 

 

 

Im too lazy to download ConsoleUtil and test it for You... but You can try it Your self

 

1) Create Bat file

2) Download ConsoleUtil and make Script with it

3) Call Your Bat File

 

Console command should look like:

Bat <Your Bat File>

 

You can use ConsoleUtil Function: ( Source in Link above )

; @brief Executes the command. ; @param a_command - The command to execute, i.e. "player.setav attackdamagemult 100". Function ExecuteCommand(String a_command) Global Native

 

 

But i don't remember if BAT Command is some DLL Command or Vanila Skyrim Console Command... so u have to test it...

 

 

Event OnInit()

ExecuteCommand( "Bat MyLovelyBat.bat" )

EndEvent

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...