Rank: Member
Groups: Approved
Joined: 12/14/2020(UTC) Posts: 11 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');
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 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?
|
|
|
|
Rank: Member
Groups: Approved
Joined: 12/14/2020(UTC) Posts: 11 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.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 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
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 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:
|
|
|
|
Rank: Member
Groups: Approved
Joined: 12/14/2020(UTC) Posts: 11 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
|
|
|
|
Rank: Member
Groups: Approved
Joined: 12/14/2020(UTC) Posts: 11 Location: busan
|
As you said, adding "" works fine.
Oh, my God. I think I've become a fool.
Thank you for your answer.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 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.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 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;
}
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 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
|
|
|
|
Rank: Member
Groups: Approved
Joined: 12/14/2020(UTC) Posts: 11 Location: busan
|
Thank you for the good idea.
Let me apply your ideas.
|
|
|
|
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.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close