Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Suggestion for SysListView32
#1
Below are the steps that I need automated. I have started on it but kinda stuck.

1. While Windows Explorer is open, I need the macro to to open the currently selected file. I was able to accomplish this by using:


Code:
Copy      Help
act "Temp"
int+ hwnd=win
int+ vFileList=id(1 hwnd)
str vCurrentFile
GetListViewItemTxt(vFileList -1 &vCurrentFile 0 2)
Acc a=acc(vCurrentFile "LISTITEM" win("Temp" "ExploreWClass") "id=1" "" 0x1000)
a.Select(SELFLAG_TAKEFOCUS|SELFLAG_TAKESELECTION)
out vCurrentFile


2. The selected file is opened and edited, I was able to this part as well, save and close the document.


3. What I need to do is the macro to select the next filename from Windows Explorer and do the same edits as Step 2. Then when it reaches the last filename from the list, is to quit the macro.


Any suggestions? I have searched the newsgroup and found the following:

Code:
Copy      Help
act "Temp"
int+ hwnd=win
int+ vFileList=id(1 hwnd)
str vCurrentFile
Acc a=acc(vCurrentFile "LISTITEM" win("Temp" "ExploreWClass") "id=1" "" 0x1000)
for a.elem 1 10000000
    vCurrentFile=a.Name; err break
    a.Select(SELFLAG_TAKEFOCUS|SELFLAG_TAKESELECTION)
    key (VK_RETURN)

I was able to work on the above example but the problem is, it is always selecting the first filename in Windows Explorer. I need to be able to start anywhere from Windows Explorer.


Thanks so much.
#2
This is a suggestion which I think it solves your problem


Code:
Copy      Help
int+ hwnd=win
int+ vFileList=id(1 hwnd)
str vCurrentFile
str sp
int item=-1
GetListViewItemText(vFileList item &vCurrentFile 0 2 &item)
int i n
int hwl=child("FolderView" "SysListView32" hwnd 0x1)
n=SendMessage(hwl LVM_GETITEMCOUNT 0 0)

for i item n
,GetListViewItemText(hwl i &sp)
,out sp

ret
#3
Hi, sorry, that will not work. As I said, I should be able to start the macro anywhere from Windoes Explorer, not from the top.
#4
I wonder whether you have tried it. In my case it works. Please try it.

Statement :

GetListViewItemText(vFileList item &vCurrentFile 0 2 &item)
returns in item the file entry to start

and :

for i item n

starts the loop from the starting (selected) file entry.

Please, do not hesitate to contact me if you have further enquiries

Regards
#5
ssimop Wrote:Statement :

GetListViewItemText(vFileList item &vCurrentFile 0 2 &item)
returns in item the file entry to start


Yes that works as I stated previously, how to select the next entry is the problem. Using the for statement always starts at the beginning of the list. I should be able to select where I would like to start and go from there.
#6
As I wrote before in my case it works perfectly. It starts at any file in the folderview list.

I wonder what is the value of item before the for loop?
#7
Sorry hun my bad, it works. I didnt read your post carefully where you took the index number and started from there :lol:

Thank you so much!!!
#8
Quick question though. I was using acc to select the file then 'Y to open it. How do I the the same using your code?

Thank you much!
#9
This is my suggestion :

Code:
Copy      Help
int+ hwnd=win
int+ vFileList=id(1 hwnd)
str vCurrentFile

int item=-1
GetListViewItemText(vFileList item &vCurrentFile 0 2 &item)
int i n
int hwl=child("FolderView" "SysListView32" hwnd 0x1)
n=SendMessage(hwl LVM_GETITEMCOUNT 0 0)

for i item n
,GetListViewItemText(hwl i &vCurrentFile)
,out vCurrentFile
,Acc a=acc(vCurrentFile "LISTITEM" hwnd "id=1" "" 0x1000)
,a.Select(SELFLAG_TAKEFOCUS|SELFLAG_TAKESELECTION)
,;; any other statements
,
ret


Best regards
#10
Thank you so much. That worked great!


Forum Jump:


Users browsing this thread: 1 Guest(s)