Posts: 46
Threads: 10
Joined: Aug 2010
How can i find all Files on Desktop with the letters "w_" on the beginning and move them in a Folder?
P.s: i always try to code by myself, use QM help and search function. So the Forum is my last option. xD
Posts: 11,924
Threads: 138
Joined: Dec 2002
ren "$desktop$\w_*" "$desktop$\folder2"
Posts: 46
Threads: 10
Joined: Aug 2010
Thanks Gintaras!
You earned the status "QM-Guru" from me. :mrgreen:
Posts: 46
Threads: 10
Joined: Aug 2010
Ok, now i found out that the scenario is a "bit" more complex. xD
I need to move the file in a folder with the name "A****"(wildcard) on Desktop (in a specific region, lets say top right)
Other folders with "A****" that are not in that region should be ignored.
I hope somebody can show me a solution for that.
Posts: 1,000
Threads: 253
Joined: Feb 2008
So i've seen a lot on the qm forum. I've always have been a fan of autmating as much as possible. This is the first time i've ever wondered why. I'm curious. :?:
Posts: 11,924
Threads: 138
Joined: Dec 2002
Do I understand correctly?
1. Enumerate desktop icons. Find icons of folders where folder name begins with "A". Also the icon must be in top-rigt part of desktop.
2. Find file X in each of the found folders, and move it to somewhere.
Macro
Macro1444
out
;define rectangle in desktop, top-right
RECT r
r.right=ScreenWidth; r.left=r.right/2; r.bottom=ScreenHeight/2
;find desktop listview control that contains icons
int hwnd=child("" "SysListView32" win("Program Manager" "Progman"))
;enumerate desktop icons
int i
for i 1 1000000
,Acc a=acc("A*" "LISTITEM" hwnd "" "" 0x1001 0 0 "" 0 i); err break ;;find next icon "A*" on desktop
,str s=a.Name
,;out s
,s-"$desktop$\"
,if(!dir(s 1)) continue ;;skip if it is not folder
,;out s
,int x y
,a.Location(x y)
,if(!PtInRect(&r x y)) continue ;;skip if the icon is not in the rectangle
,out s
,
,;s+"\X.txt"
,;mov s somewhere
,
Posts: 46
Threads: 10
Joined: Aug 2010
Thanks for your helpfulness Gintaras!
Without your help i would be damned to fail. :mrgreen:
I try to describe it a bit better..
1.Find all Files from A to Z (only with the following string _ after first Letter: "A_****" B_**** etc.."
2. Move each file in the folder with the same Letter on the beginning ( Move file A_testfile.txt in folder "Aircondition")
The folder Aircondition needs to be in a specific region of Desktop. (Because there could be other Folders with A****)
I thaugt about making a self-cleaning Desktop with four regions. One of the regions is the Datastore. The user can place Folders from A to Z there.
And if he names a file A_testfile it should automatically move to the folder Aircondition wich is in the region "Datastore".
(If the user enables the button "Autoclean")
But if the user gots another folder on Desktop that begins with A too, there is a problem for QM to find the right folder.
This one of more reasons why i planned to make different Regions on Desktop.
One of them is the construction area. The files in construction area are not affected from autoclean.
Posts: 11,924
Threads: 138
Joined: Dec 2002
Which part is what you don't know how to do?
Posts: 46
Threads: 10
Joined: Aug 2010
Its Part 1 and 2
I am still new to QM. I think the hardest part is part 2 (find out if the folder (A - Z) is in the specific region on Desktop).
You dont need to show me the finished code for part 1. I think a little tip could be enough.
Dont worry, i come again to ask if i got problems. :lol: