[BUG] cm_SaveSelection/cm_RestoreSelection

English support forum

Moderators: white, Hacker, petermad, Stefan2

Jungle
Member
Member
Posts: 129
Joined: 2005-12-03, 11:18 UTC
Contact:

[BUG] cm_SaveSelection/cm_RestoreSelection

Post by *Jungle »

Select some files/dirs then apply the following:
1. cm_SaveSelection
2. cm_ClearAll
3. cm_CopyNamesToClip
4. cm_RestoreSelection

Selection is not restored! If, for example, you just copy/paste some text instead of p.3, selection is restored normally.
User avatar
Gral
Power Member
Power Member
Posts: 1467
Joined: 2005-01-26, 15:12 UTC

Post by *Gral »

Confirmed.
TC 6.53
TC 6.54 PB 3
Windows XP
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Ditto.

Icfu
This account is for sale
User avatar
StickyNomad
Power Member
Power Member
Posts: 1933
Joined: 2004-01-10, 00:15 UTC
Location: Germany

Post by *StickyNomad »

confirmed here, too.

In my case, the saved selection is also not restored if I select any filename for renaming (even if renaming is canceled and the rename file was not part of the selection).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Some file operations perform an autmoatic cm_saveselection, so you will be restoring this instead of the manually saved selection.
Author of Total Commander
https://www.ghisler.com
Jungle
Member
Member
Posts: 129
Joined: 2005-12-03, 11:18 UTC
Contact:

Post by *Jungle »

ghisler(Author) wrote:Some file operations perform an autmoatic cm_saveselection, so you will be restoring this instead of the manually saved selection.
1. so, in my case
cm_copynamestoclip causes a blank selection (nothing) to be saved? just can't understand why.

2. i don't wanna lose
selection and saving it to file (as it is now) is not convenient (e.g. in case of automating with ahk). maybe silent saving to default file?
User avatar
Vochomurka
Power Member
Power Member
Posts: 814
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

Single user license #329241
PowerPro scripts for Total Commander
Jungle
Member
Member
Posts: 129
Joined: 2005-12-03, 11:18 UTC
Contact:

Post by *Jungle »

1. thanks. i've read it briefly and what i can say now that problem is not copying, one is restoring selection to file panel. any advice?
2. (little OT) maybe someone tell me how can i get file/dir name which is under cursor even some others are selected?
User avatar
StickyNomad
Power Member
Power Member
Posts: 1933
Joined: 2004-01-10, 00:15 UTC
Location: Germany

Post by *StickyNomad »

2. (little OT) maybe someone tell me how can i get file/dir name which is under cursor even some others are selected?
When you press CTRL+SHIFT+ENTER, the filename with the cursor on it is copied to the command line. Then you can press CURSOR Left/right to have the command line activated and the text selected. Copy it and you're set. Maybe this helps you.
User avatar
Vochomurka
Power Member
Power Member
Posts: 814
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

Jungle wrote:maybe someone tell me how can i get file/dir name which is under cursor even some others are selected?
It can be done with scripts. In brief, you get the listbox handle, then the current cursor position can be retreived. Next, you list all files in dir and get the item with the same number. Although there are some problems. For ex., this would hardly work in listbox after search. Second, the sorting order in both lists must be the same.
What about pressing Ctrl+T? The same dir opens without selection. You point the file you need and that's all.
Single user license #329241
PowerPro scripts for Total Commander
Jungle
Member
Member
Posts: 129
Joined: 2005-12-03, 11:18 UTC
Contact:

Post by *Jungle »

Vochomurka wrote:It can be done with scripts. In brief, you get the listbox handle, then the current cursor position can be retreived.
1. i can get current index, but i can't get its text. could you provide me with a
working example (for TC), please?
2. i can use CTRL+T but i need to keep selection.
3. i've just thought of copying to comm. line. will try.
User avatar
Vochomurka
Power Member
Power Member
Posts: 814
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

Jungle wrote:1. i can get current index, but i can't get its text. could you provide me with a working example (for TC), please?
Sorry, I can tell you about PowerPro only. If you have PowerPro installed, go to the \plugins\ subfolder and read 'file.txt' file - you need 'listfiles' function. It returns the list of all files in dir specified.
About examples. Please visit my page with PowerPro scripts for TC (link below any my post). There are A LOT of scripts that use 'listfiles' function. For example, http://ppro.totalcmd.net/Scripts/SubDirList.htm
2. i can use CTRL+T but i need to keep selection.
What's the problem? You have two tabs with the same dir - first contains your selection, second has no selection, so you can put cursor on any file and execute either an internal TC command or a script to copy single file name to the clipboard. Do you understand me?
3. i've just thought of copying to comm. line. will try.
It can be only useful to learn the current directory. Am I right?
Last edited by Vochomurka on 2006-01-30, 22:49 UTC, edited 1 time in total.
Single user license #329241
PowerPro scripts for Total Commander
User avatar
StickyNomad
Power Member
Power Member
Posts: 1933
Joined: 2004-01-10, 00:15 UTC
Location: Germany

Post by *StickyNomad »

2Vochomurka
It can be only useful to learn the current directory. Am I right?
Yes you are, but as Jungle stated two posts above, he was looking for a possibility to...
2. (little OT) maybe someone tell me how can i get file/dir name which is under cursor even some others are selected?
Maybe you have overseen this one.
User avatar
Vochomurka
Power Member
Power Member
Posts: 814
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

2StickyNomad
Maybe you have overseen this one.
Not really. There are many ways to get the current directory name (I know four of them :)). But what is a problem is to get the current file name if other files are selected. I have no ready solution. But the one proposed by you is promising...
Last edited by Vochomurka on 2006-01-30, 22:52 UTC, edited 1 time in total.
Single user license #329241
PowerPro scripts for Total Commander
User avatar
Hacker
Moderator
Moderator
Posts: 13068
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Jungle,
2. i don't wanna lose
selection and saving it to file (as it is now) is not convenient (e.g. in case of automating with ahk).
I solved it this way:

Code: Select all

ClipboardBackup = %ClipboardAll%
; cm_CopyNamesToClip
PostMessage, 1075, 2017
SelBackup = %ClipboardAll%
; cm_ClearAll
PostMessage, 1075, 524
; cm_CopyNamesToClip
PostMessage, 1075, 2017
	DoThisAndThatWithNameUnderCursor(NowInClipboard)
Clipboard = %SelBackup%
SelBackup =
; cm_LoadSelectionFromClip
PostMessage, 1075, 2033
Clipboard = %ClipboardBackup%
ClipboardBackup =
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply