How can simulate the press of the "HOME" key in a script ?
-
Ysl
- Posts: 162
- Joined: 03 Jan 2007 22:22
How can simulate the press of the "HOME" key in a script ?
Hi
I would like to know how can simulate the press of the "HOME" key in a script ?
thanks for your kelp !
Ysl
I would like to know how can simulate the press of the "HOME" key in a script ?
thanks for your kelp !
Ysl
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
Re: How can simulate the press of the "HOME" key in a script
Ysl wrote:Hi
I would like to know how can simulate the press of the "HOME" key in a script ?
thanks for your kelp !
Ysl
Code: Select all
//Go home
#348;
-
eil
- Posts: 1866
- Joined: 13 Jan 2011 19:44
Re: How can simulate the press of the "HOME" key in a script
i guess he was asking for this:
Code: Select all
sendkeys "{home}";Win 7 SP1 x64 100% 1366x768|1900x1080
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
Re: How can simulate the press of the "HOME" key in a script
Oh! thats right. But in this situation context is important. Depends on what the user is trying to achieve. Maybe add focus; before sendkeys if its for list or focus tree; if its for tree.eil wrote:i guess he was asking for this:Code: Select all
sendkeys "{home}";
-
Ysl
- Posts: 162
- Joined: 03 Jan 2007 22:22
Re: How can simulate the press of the "HOME" key in a script
Thanks all for your help !
Unfortunately, none works for me...
Let me explain a little bit more.
This script (thanks to the forum helpers!)0, applied to a file, create a new file with same name with new .txt extension, move it to the Dummy folder then delete the original file.
But at the end of the script, the "selection" is at the bottom of the list (file are sorted by created date) and I always have to push the HOME key to go back to where I was (at the top of the list/window). So I would like to do this automatically...
BTW there is an active Visual filter which show only music files. And with the #348; command, the list is at the top of the list BUT Visual filter is cancelled and date sorting also (now the list is sorted alphabetically) and more columns are created (ATTR/LEN/TAGS/COMMENTS etc)...
EDIT: with "sendkeys "{HOME}";" (HOME is now Uppercase), I get the same result as the #348; command
That's strange because if I press the Home key I should get the same result as the sendkeys "{HOME}"; ????
I hope it's more clear to understand my problem and sorry for my bad english
Unfortunately, none works for me...
Let me explain a little bit more.
Code: Select all
End GetInfo("CountSelected") < 1, "No item(s) selected.";
Global $files;
$files = Report("{Dir |{FullName};{Ext}<crlf>|}", 1);
Setting "AllowRecursion", 1;
Sub "_newTXT";
$files = RegexReplace($files, "^(.*);.*<crlf>", "$1|");
Delete 1,0,$files;
"_newTXT"
Global $files, $i;
$i = $i Like "" ? 1 : $i;
$token = GetToken($files, $i, "<crlf>");
End $token Like "",, 1;
$file = GetToken($token, 1, ";");
$ext = GetToken($token, 2, ";");
$newFile = RegexReplace($file, "$ext$", "txt");
New $newFile;
$i = $i + 1;
Sub "_newTXT";
moveto "F:\Dummy Files", $newFile;But at the end of the script, the "selection" is at the bottom of the list (file are sorted by created date) and I always have to push the HOME key to go back to where I was (at the top of the list/window). So I would like to do this automatically...
BTW there is an active Visual filter which show only music files. And with the #348; command, the list is at the top of the list BUT Visual filter is cancelled and date sorting also (now the list is sorted alphabetically) and more columns are created (ATTR/LEN/TAGS/COMMENTS etc)...
EDIT: with "sendkeys "{HOME}";" (HOME is now Uppercase), I get the same result as the #348; command
That's strange because if I press the Home key I should get the same result as the sendkeys "{HOME}"; ????
I hope it's more clear to understand my problem and sorry for my bad english
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: How can simulate the press of the "HOME" key in a script
It doesn't matter which file / folder is selected after you've run the script?
Just add a
to your code...
At least it serves your purpose
Just add a
Code: Select all
sel 1;At least it serves your purpose
One of my scripts helped you out? Please donate via Paypal
-
Ysl
- Posts: 162
- Joined: 03 Jan 2007 22:22
Re: How can simulate the press of the "HOME" key in a script
"sel 1;"
GREAT ! Exactly what I was lookig for !
Does this script SELECT line 1 ?
thanks !
GREAT ! Exactly what I was lookig for !
Does this script SELECT line 1 ?
thanks !
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: How can simulate the press of the "HOME" key in a script
Exactly.Does this script SELECT line 1 ?
One of my scripts helped you out? Please donate via Paypal
-
Ysl
- Posts: 162
- Joined: 03 Jan 2007 22:22
Re: How can simulate the press of the "HOME" key in a script
Ok ! but this make me think it would be even better that the line number selected at the end of the script (line 1 for now) would be the same as the one of the .mp3 file I selected at the beginning of the script..
So is it possible to save the original line number as a variable and at the end of the script input the variable value to get back to the original line selected ?
So if I'm on line 6 when I call the script, at the end I would be back on line 6
That would be even greater !!
Thanks
So is it possible to save the original line number as a variable and at the end of the script input the variable value to get back to the original line selected ?
So if I'm on line 6 when I call the script, at the end I would be back on line 6
That would be even greater !!
Thanks
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: How can simulate the press of the "HOME" key in a script
This will always select the first file from your original selection, when the script has finished
it's job.
it's job.
Code: Select all
End GetInfo("CountSelected") < 1, "No item(s) selected.";
Global $files, $select;
$files = Report("{Dir |{FullName};{Ext}<crlf>|}", 1);
$select = gettoken($files, 1, ";");
Setting "AllowRecursion", 1;
Sub "_newTXT";
$files = RegexReplace($files, "^(.*);.*<crlf>", "$1|");
Delete 1,0,$files;
"_newTXT"
Global $files, $select, $i;
$i = $i Like "" ? 1 : $i;
$token = GetToken($files, $i, "<crlf>");
End $token Like "",, 1;
$file = GetToken($token, 1, ";");
$ext = GetToken($token, 2, ";");
$newFile = RegexReplace($file, "$ext$", "txt");
New $newFile;
$i = $i + 1;
Sub "_newTXT";
moveto "F:\Dummy Files", $newFile;
sel "[$select]", , 1;
One of my scripts helped you out? Please donate via Paypal
-
Ysl
- Posts: 162
- Joined: 03 Jan 2007 22:22
Re: How can simulate the press of the "HOME" key in a script
thanks but this script showed me 2 errors




-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: How can simulate the press of the "HOME" key in a script
Code: Select all
"_newTXT"Global $files, $select, $i;But it doesn't matter anyway. All of your files are deleted / moved so it makes no sense to save the first file and try to select it afterwards. Time for a different solution.
One of my scripts helped you out? Please donate via Paypal
-
Ysl
- Posts: 162
- Joined: 03 Jan 2007 22:22
Re: How can simulate the press of the "HOME" key in a script
Sorry but this is beyond my comprehension....
XYplorer Beta Club