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

Notification

Icon
Error

Options
Go to last post Go to first unread
Robert "Bob" Belcher, Jr.  
#1 Posted : Friday, December 4, 2020 10:18:58 AM(UTC)
Robert "Bob" Belcher, Jr.

Rank: Newbie

Reputation:

Groups: Approved
Joined: 12/4/2020(UTC)
Posts: 5

Was thanked: 1 time(s) in 1 post(s)
Hi.

My search skills seem to suck, so i have to ask you for help on these (i guess) rather simple questions.

1) how do i start a program with arguments?
i tried "Run program" and "arguments", but i only get one argument at the same time to work. Crying
Code:
C:\Users\usaname\Download\Portable\_desktop\PopSel.exe /i meintest.lst


2) how do i use special characters like "+" and "~" etc in a "text expansion" "automation" script?
the result should look like that: @ 08:00 +++ Vitamin C ~100 mg.

Code:
var d = new Date();
var timeString = "@ "
                         + ("0" + d.getHours()).slice(-2) 
                         +  ":" 
                         + ("0" + d.getMinutes()).slice(-2)
                         + " +++ Vitamin C ~100 mg.";

sp.SendKeys(timeString);


Thanks in advance! ThumpUp
Rob  
#2 Posted : Friday, December 4, 2020 11:21:19 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 20 times
Was thanked: 222 time(s) in 193 post(s)
1)

I'm not able to reproduce this issue. I downloaded PopSel and tested "/i System.lst" (icons showed) and just "System.lst" (no icons).
Are you using Steps or Script for this?
Can you send any screenshots of the setup for the action in S+?

2)

SendKeys is a specific type of input sending, using custom identifiers to simulate different keystrokes, for example "+" is the Shift key.

Documentation: https://docs.microsoft.c...?view=netframework-4.6.2

In your case, you're just trying to send a string of characters, so just use sp.SendString:
Code:
var d = new Date();
var timeString = "@ "
                         + ("0" + d.getHours()).slice(-2) 
                         +  ":" 
                         + ("0" + d.getMinutes()).slice(-2)
                         + " +++ Vitamin C ~100 mg.";

sp.SendString(timeString);
Robert "Bob" Belcher, Jr.  
#3 Posted : Saturday, December 5, 2020 6:08:03 PM(UTC)
Robert "Bob" Belcher, Jr.

Rank: Newbie

Reputation:

Groups: Approved
Joined: 12/4/2020(UTC)
Posts: 5

Was thanked: 1 time(s) in 1 post(s)
Thank you for your quick reply and help.
Both working now.
I still dont understand why 1) is working now, cause i am sure i was doing exactly what you proposed multiple times and it didnt worked then.
Maybe i got mini-strokepluses or failed at copy paste.
But all good now, thanks.
Robert "Bob" Belcher, Jr.  
#4 Posted : Sunday, December 6, 2020 2:31:38 AM(UTC)
Robert "Bob" Belcher, Jr.

Rank: Newbie

Reputation:

Groups: Approved
Joined: 12/4/2020(UTC)
Posts: 5

Was thanked: 1 time(s) in 1 post(s)
In the 2) "text expansion" "automation" script, would it be possible to have the cursor be positioned somewhere else than at the end of the line?

for example:
instead of this:
@ 10:12 +++ Vitamin C ~ 100 mg.|cursor|
that:
@ 10:12 +++ Vitamin C ~ 1|cursor|00 mg.
Rob  
#5 Posted : Sunday, December 6, 2020 7:06:53 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 20 times
Was thanked: 222 time(s) in 193 post(s)
You just have to move the cursor manually by sending the Left arrow key
Code:
//Define the token to make it easy for other code to use the same value
var cursorToken = "|cursor|";

var d = new Date();
var timeString = "@ "
               + ("0" + d.getHours()).slice(-2) 
               +  ":" 
               + ("0" + d.getMinutes()).slice(-2)
               + " +++ Vitamin C ~1"+cursorToken+"00 mg.";

//Remove the cursor token from the string to send
sp.SendString(timeString.replace(cursorToken,''));

//Find the cursor start location
var tokenLoc = timeString.indexOf(cursorToken);

//if the cursor token was found
if(tokenLoc > -1)
{
    //Set loop counter start to the end of the cursor token
    tokenLoc = tokenLoc + cursorToken.length;
    
    //From the end of the token until the end of the string
    for(var i = tokenLoc; i < timeString.length; i++)
    {
        //Send the Left arrow key
        sp.SendVKey(vk.LEFT);
    }
}
Robert "Bob" Belcher, Jr.  
#6 Posted : Sunday, December 6, 2020 8:15:35 AM(UTC)
Robert "Bob" Belcher, Jr.

Rank: Newbie

Reputation:

Groups: Approved
Joined: 12/4/2020(UTC)
Posts: 5

Was thanked: 1 time(s) in 1 post(s)
Thanks a lot.
Your annotations may help me understand that some day. Drool
Rob  
#7 Posted : Sunday, December 6, 2020 9:53:49 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 20 times
Was thanked: 222 time(s) in 193 post(s)
Haha. It's not too complicated!
Code:
timeString: @ 11:36 +++ Vitamin C ~1|cursor|00 mg.

timeString.replace(cursorToken,'')

  Returns a new string (to be sent as keystrokes), replacing "|cursor|" with nothing, 
  an empty string "" (@ 11:36 +++ Vitamin C ~100 mg.). 
  However, the timeString variable still remains the same and contains "|cursor|".

var tokenLoc = timeString.indexOf(cursorToken);

  Sets tokenLoc to the index (number) of the first character of the token "|cursor|".

@ 11:36 +++ Vitamin C ~1|cursor|00 mg.
                        ^
                        tokenLoc = 24

tokenLoc = tokenLoc + cursorToken.length;

  Sets the tokenLoc to the end of the token; start location + length of "|cursor|" (8 characters)

@ 11:36 +++ Vitamin C ~1|cursor|00 mg.
                                ^
                                tokenLoc = 32

for(var i = tokenLoc; i < timeString.length; i++)

  Start at position 32 and loop (repeat) while i (set as 32) is less than the length of 
  timeString (38 total characters) - keep in mind the first character's index is 0 not 1.
  Each time the loop is complete, it increments i by 1 (33, 34, 35, etc) - when i equals
  the length of the string it stops looping.

  So for each remaining character after the token, send the Left arrow key

  "00 mg." = 6 characters

  Send Left 6 times
Robert "Bob" Belcher, Jr.  
#8 Posted : Wednesday, December 9, 2020 8:43:33 PM(UTC)
Robert "Bob" Belcher, Jr.

Rank: Newbie

Reputation:

Groups: Approved
Joined: 12/4/2020(UTC)
Posts: 5

Was thanked: 1 time(s) in 1 post(s)
Quote:
Haha. It's not too complicated!
Code:
timeString: complicated math alien gibberish.
timeString.replace(makesperfect,sense.to.me,'')
...


Haha. I appreciate your effort in making me learn something. Wink
My two greatest assets have been mental stability and being, like, really smart.
I don’t have to be told the same thing in the same words every single day.
But did i learn something? What a terrible question to ask!
But, uuh, ask me that in a number of weeks from now.
I’m, like, a smart person. personwomanmancameratv.
Very. Stable. Genius.
thanks 1 user thanked Robert "Bob" Belcher, Jr. for this useful post.
Rob on 12/10/2020(UTC)
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.