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 : Wednesday, January 20, 2021 7:04:42 PM(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 : Wednesday, January 20, 2021 7:20:22 PM(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)
What is d? Is that a program, a bat file? What should this be doing?
fury  
#3 Posted : Thursday, January 21, 2021 4: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 5:47:27 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)
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 5:48:20 AM(UTC)  | Reason: Not specified

Rob  
#5 Posted : Thursday, January 21, 2021 5:51:56 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)
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 6:00:13 AM(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 9:09:38 AM(UTC)  | Reason: Not specified

fury  
#7 Posted : Thursday, January 21, 2021 6:05:05 AM(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 6:08:18 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)
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 6:23:48 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)
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 6:31:44 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)
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 6:33:12 AM(UTC)  | Reason: Not specified

fury  
#11 Posted : Thursday, January 21, 2021 9:23:12 AM(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.