StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
rookie to scripts  
#1 Posted : Sunday, March 24, 2024 11:16:43 AM(UTC)
rookie to scripts

Rank: Newbie

Reputation:

Groups: Approved
Joined: 3/24/2024(UTC)
Posts: 5
Location: outer space

i just start to use strokesplus.net.... hope can find some help here.
is there a way to use like `action--run--command-- %temp%\dopusrt.exe.lnk /cmd go up` ?
run with a variable not Specify path like: d:\xx\xx.exe.lnk


here's the thing, i use dopus, and put strokesplus.net portable in dopus folder.
so i could run strokesplus by dopus command.
for some reason i considering dopus or other programs trigger by mouse gestures might be in different folder different path. like putting dopus and strokesplus in a usb driver.

so it can't use a absolute path to run the program. i have to use it with relative path.


exampe: dopus in x:\dopus\ , strokesplus in x:\dopus\strokesplusPortable\, is there a way make strokesplus send command to x:\dopus\dopusrt.exe without using x:\dopus but environment various like %temp%?

or simply at the window of dopus, but use mouse gestures send command to dopusrt.exe?

or send command to a running process which can be showed in task manager?

tried to make a script by chatGpt, but doesn't work. such like ` var com = `wmic process where "name='${processName}'" get ExecutablePath /value`; ` can see the path by cmd, but it include extra characters `ExecutablePath=` ,
and i can't figure it out how to remove these characters.
Rob  
#2 Posted : Monday, March 25, 2024 2:13:36 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,372
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 423 time(s) in 359 post(s)
You can use ExpandEnvironmentVariables:
Code:
//Note that you need to escape backslashes - \\ for each \
var cmd = System.Environment.ExpandEnvironmentVariables("%temp%\\text.exe");
StrokesPlus.Console.Log(cmd);

Output:
Code:
C:\Users\robya\AppData\Local\Temp\text.exe

Edited by user Monday, March 25, 2024 2:15:33 AM(UTC)  | Reason: Not specified

Rob  
#3 Posted : Monday, March 25, 2024 2:23:41 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,372
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 423 time(s) in 359 post(s)
Also, once you get a window for a process, e.g. sp.ForegroundWindow(), action.Window (from within an action's script), or via several other possible ways, you can obtain the path and executable name.
Code:
//Get window which has current focus
var wnd = sp.ForegroundWindow();
StrokesPlus.Console.Log(wnd.ExecutablePath);
StrokesPlus.Console.Log(wnd.ExecutableName);

Output:
Code:
C:\Program Files\StrokesPlus.net
StrokesPlus.net.exe


Code:
//From an action script
StrokesPlus.Console.Log(action.Window.ExecutablePath);
StrokesPlus.Console.Log(action.Window.ExecutableName);

Output:
Code:
C:\Program Files\Google\Chrome\Application
chrome.exe

rookie to scripts  
#4 Posted : Monday, March 25, 2024 4:19:30 AM(UTC)
rookie to scripts

Rank: Newbie

Reputation:

Groups: Approved
Joined: 3/24/2024(UTC)
Posts: 5
Location: outer space

thanks Rob, i need some time to figure out how to use the codes make them work.

in fact, using `%temp%\dopusrt.exe.lnk /cmd go up` is a backup solution.
the first solution should use strokeplus.net locate the running process directly without a window exist or not. and send the command directly to the process .
or by locate the running process find out the path and make it send command with it.
it feels like it could be done by the codes that you mentioned.
but i kind of worried will the script spend too much time to run? maybe it's no necessary to worry about.


hope i can come back with good news. (灬°ω°灬)

Edited by user Monday, March 25, 2024 4:44:44 AM(UTC)  | Reason: Not specified

rookie to scripts  
#5 Posted : Wednesday, March 27, 2024 8:09:58 AM(UTC)
rookie to scripts

Rank: Newbie

Reputation:

Groups: Approved
Joined: 3/24/2024(UTC)
Posts: 5
Location: outer space

hmmmm. is StrokesPlus, win7 0.4.1.2 portable different with the newest version?
none of them can use directly. all error.

Quote:
use ExpandEnvironmentVariables:


//Note that you need to escape backslashes - \\ for each \
var cmd = System.Environment.ExpandEnvironmentVariables("%temp%\\text.exe");
StrokesPlus.Console.Log(cmd);

Output:
C:\Users\robya\AppData\Local\Temp\text.exe


it reports:
Quote:

ReferebceErrir: System is not defined
at script:4:11 -> var cmd =
System.Environment.ExpandEnvironmentVariables("%temp%\\text.exe");


and where do i open the `StrokesPlus.Console.Log` the log to check?

hmmmm.`StrokesPlus.Console.Log("1234")`
Quote:

script execution failed.
ReferebceErrir: StrokesPlus is not defined

i think i need a full code example to see if i can edit it out or by chatgpt....i do tried, but no good news.

there are more text but no need post out, i think you already know i'm not a programer at all. the weird test no need to know.


i do have backup solution to work it out. like not `%temp%\dopusrt.exe.lnk` , but always at `d:\DeleteItAnyTime\dopusrt.exe.lnk` and run StrokesPlus.net with `new action -- Insert step --new step--command, Run-- d:\DeleteItAnyTime\dopusrt.exe.lnk /cmd Go UP `
i can set a button in dopus to create such a .lnk file ensure StrokePlus.net works.

it just feeling not so convenient....hope can solve it by StrokesPlus by itself, that's the best way. now it seems i'll never find a way to make it.(。﹏。)
Rob  
#6 Posted : Wednesday, March 27, 2024 12:28:33 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,372
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 423 time(s) in 359 post(s)
Oh you're using an older version of S+, try this and see if it works:
Code:
var cmd = sp.ExpandEnvironmentVariables("%temp%\\text.exe");
sp.MessageBox(cmd, "Expanded");
rookie to scripts  
#7 Posted : Thursday, March 28, 2024 12:03:50 PM(UTC)
rookie to scripts

Rank: Newbie

Reputation:

Groups: Approved
Joined: 3/24/2024(UTC)
Posts: 5
Location: outer space

thanks Rob....all end. finally make it.
Code:

var cmd = sp.ExpandEnvironmentVariables("%temp%\\dopusrt.exe.lnk");
sp.Run(cmd + " /cmd go up");


this is the first code, that use the .lnk file. as a backup solution here.
and i also find out a way to run by the window.

Code:

var exePath = action.Window.Process.MainModule.FileName;
var result = exePath.replace(/(\\dopus)\.exe/, "$1rt.exe");
sp.Run('"' + result + '" /cmd go up')


all start with:
Code:

var cmd = sp.ExpandEnvironmentVariables("%temp%\\text.exe");
sp.MessageBox(cmd, "Expanded");


since this works it kind of open my mind, then i try to re-search in the `script help document`, then i do find something else that actully could make it work.
but yes, i'm not a programer. so i ask ChatGpt. and with some hint, it really works....
like:




the test record, really really massive words. if try to enjoy some fun,



oh, by the way....sometimes i really think most of the forum font size a little too small that i need to focus to read the words....like seducing me to get more closer to the monitor.Tongue


Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.