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

Notification

Icon
Error

Options
Go to last post Go to first unread
fury  
#1 Posted : Thursday, January 21, 2021 2:04:42 AM(UTC)
fury

Rank: Member

Reputation:

Groups: Approved
Joined: 12/14/2020(UTC)
Posts: 11
Korea, Republic Of
Location: busan

No prablum before the update.

Error after updating to 0.4.1.1 today

Test Results, Error when sp.run has a space


------cord---------

sp.Run('D:\\d d');

------error massage-------

Scripting engine Fallure

Scrip execution failed.

Error: Windows cannot find the specified file.

at Script [4]:3:4 -> sp.Run('D:\\d d');

Rob  
#2 Posted : Thursday, January 21, 2021 2:20:22 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
What is d? Is that a program, a bat file? What should this be doing?
fury  
#3 Posted : Thursday, January 21, 2021 11:01:58 AM(UTC)
fury

Rank: Member

Reputation:

Groups: Approved
Joined: 12/14/2020(UTC)
Posts: 11
Korea, Republic Of
Location: busan

sp.Run('D:\\d d');

When I run the syntax, a window file explorer with path 'D:\dd' is launched.

I've been using that syntax in S+ and S+net without any problems.

From Rob's reaction, it doesn't seem like the right way to use it this way

I'll find another way.
Rob  
#4 Posted : Thursday, January 21, 2021 12:47:27 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
No, that was not what I meant.

I'm just trying to understand what that should do - meaning, what did that command used to do before the update?

This will help me understand how to make it work with the updates I made to sp.Run.
The new changes are important for some folks, but I also want to make sure that it doesn't break anything for others like you.

Edited by user Thursday, January 21, 2021 12:48:20 PM(UTC)  | Reason: Not specified

Rob  
#5 Posted : Thursday, January 21, 2021 12:51:56 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Wait, is "d d" a folder on your D: drive?

If so, then yes the updates to sp.Run would break that.

Try enclosing the path in quotes:
Code:
sp.Run('"D:\\d d"');
fury  
#6 Posted : Thursday, January 21, 2021 1:00:13 PM(UTC)
fury

Rank: Member

Reputation:

Groups: Approved
Joined: 12/14/2020(UTC)
Posts: 11
Korea, Republic Of
Location: busan

Code:
sp.Run('d:\\download');

for (var i = 0; i < 100; i++){
 sp.Sleep(50);
 var wnd = sp.WindowFromClassOrTitle('', 'D://')

  if(wnd!= null){
   var position = wnd.Position;
   position.Top = wnd.Screen.WorkingArea.Top;
   position.Bottom  = position.Top + parseInt(wnd.Screen.WorkingArea.Height + 7);
   position.Left = wnd.Screen.WorkingArea.Left-7 + parseInt(wnd.Screen.WorkingArea.Width / 2);
   position.Right = position.Left + parseInt(wnd.Screen.WorkingArea.Width / 2 + 14);
   wnd.Position = position;
   break
}

}

Open the Download folder with Windows File Explorer

Code:
sp.Run('C:\\Program Files\\Program Launcher');

for (var i = 0; i < 100; i++){
 sp.Sleep(50);
 var wnd = sp.WindowFromClassOrTitle('', 'Program Launcher')

  if(wnd!= null){
   var position = wnd.Position;
   position.Top = wnd.Screen.WorkingArea.Top;
   position.Bottom  = position.Top + parseInt(wnd.Screen.WorkingArea.Height + 7);
   position.Left = wnd.Screen.WorkingArea.Left-7;
   position.Right = position.Left + parseInt(wnd.Screen.WorkingArea.Width / 2 + 14);
   wnd.Position = position;
   break
}

}


Open the 'Program Launcher' folder, a collection of shortcut icons for numerous programs with Windows File Explorer


I am using 'sp.Run' to open a specific folder with Windows File Explorer.

Edited by user Thursday, January 21, 2021 4:09:38 PM(UTC)  | Reason: Not specified

fury  
#7 Posted : Thursday, January 21, 2021 1:05:05 PM(UTC)
fury

Rank: Member

Reputation:

Groups: Approved
Joined: 12/14/2020(UTC)
Posts: 11
Korea, Republic Of
Location: busan

As you said, adding "" works fine.

Oh, my God. I think I've become a fool.

Thank you for your answer.
Rob  
#8 Posted : Thursday, January 21, 2021 1:08:18 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Actually, I've just released 0.4.1.2 which correctly handles that issue.

Now it will first check to see if the entire command is a file or folder and not require enclosing quotes.
Rob  
#9 Posted : Thursday, January 21, 2021 1:23:48 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Also, instead of having sleep loops, you could use Global Actions > Window Events > Foreground Window Change.

However, it would always set the position anytime the window gained focus - so this would only be if you always want the window to be in the same location and never somewhere else.

You would be able to move it, but once it lost and gained focus again (even for a moment), it would move back to the fixed location.
Code:
var currApp = sp.ForegroundWindow();

if(currApp.Title === "Program Launcher") {
   var position = currApp.Position;
   position.Top = currApp.Screen.WorkingArea.Top;
   position.Bottom  = position.Top + parseInt(currApp.Screen.WorkingArea.Height + 7);
   position.Left = currApp.Screen.WorkingArea.Left-7;
   position.Right = position.Left + parseInt(currApp.Screen.WorkingArea.Width / 2 + 14);
   currApp.Position = position;
}
Rob  
#10 Posted : Thursday, January 21, 2021 1:31:44 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Another option instead of the loop would be to use a timer, as this frees up the script engine.

For just opening folders, I don't think it's necessary since it will happen quickly. But just for information as it is very useful for many other tasks where you don't want the script engine to be spinning in a loop, using up CPU and limiting how many engines are available for other scripts.
Code:
sp.Run('C:\\Program Files\\Program Launcher');

sp.CreateTimer("ProgramLauncherPosition", 
        50, // wait to start timer (ms)
        50, // between each timer interval (ms)
        `var wnd = sp.WindowFromClassOrTitle('', 'Program Launcher')
          if(wnd != null){
            var position = wnd.Position;
            position.Top = wnd.Screen.WorkingArea.Top;
            position.Bottom  = position.Top + parseInt(wnd.Screen.WorkingArea.Height + 7);
            position.Left = wnd.Screen.WorkingArea.Left-7;
            position.Right = position.Left + parseInt(wnd.Screen.WorkingArea.Width / 2 + 14);
            wnd.Position = position;
            sp.DeleteTimer("ProgramLauncherPosition"); // Stop timer
          }`
); 

Edited by user Thursday, January 21, 2021 1:33:12 PM(UTC)  | Reason: Not specified

fury  
#11 Posted : Thursday, January 21, 2021 4:23:12 PM(UTC)
fury

Rank: Member

Reputation:

Groups: Approved
Joined: 12/14/2020(UTC)
Posts: 11
Korea, Republic Of
Location: busan

Thank you for the good idea.

Let me apply your ideas.
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.