Copy files to specified folders depending on their filename?

English support forum

Moderators: white, Hacker, petermad, Stefan2

hiccup
Junior Member
Junior Member
Posts: 63
Joined: 2018-05-13, 08:04 UTC

Post by *hiccup »

Ok, I had to be a little creative: the screenshot is now in my signature below.
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

2hiccup

Copy all 7 lines and paste them into button bar, then edit button with your actual data.

Don't forget redownload current version.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
hiccup
Junior Member
Junior Member
Posts: 63
Joined: 2018-05-13, 08:04 UTC

Post by *hiccup »

Ah, I get it, that's handy.
Thanks again, on to the next hurdle;-)
hiccup
Junior Member
Junior Member
Posts: 63
Joined: 2018-05-13, 08:04 UTC

Post by *hiccup »

Ovg wrote:2hiccup

I have found and fixed a small bug. Please re-download file
from my post. Link is the same.
It's not working yet, and I am trying to find out where it goes wrong.

I am wondering if the AHK script you supplied is working on my system at all.
When I create a small test script myself to see if AHK works, and I select 'Run script' on it, it works, and a small AHK icon appears in the taskbar.

But when I select 'Run script' on your (untouched) script, nothing seems to happen, and no icon appears in the taskbar.
Should the icon appear, or shouldn't I worry about that?

(In case it's important: I installed AHK with the (recommended) setting: Unicode 32-bit)
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

2hiccup

Icon appears only while script is working. In case of a small quantity of entries in ini file you might overlook it

Script works only when TC or you pass list of files as command line parameter.

Configure ini file something like

[0]
Overwrite=1

[1]
Keys=Cat/Dog/Mouse/Degus
Target=g:\Animals

[2]
Keys=Beef/Apple/Orange/Fruit
Target=g:\Food and Drink

FilesCopy.ahk from 14-05-2018 07:47
Last edited by Ovg on 2018-05-14, 12:12 UTC, edited 1 time in total.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
hiccup
Junior Member
Junior Member
Posts: 63
Joined: 2018-05-13, 08:04 UTC

Post by *hiccup »

I've got the button working, but immediately after performing the action, AHK gives a popup error: "Can't open FilesCopy.ini"

I checked to be certain; FilesCopy.ini is present in the same folder as the script. (I created C:\AHK scripts for that purpose)

One thing that is different from your tutorial:
You mentioned that the ini should be saved in UTF-16 with BOM.

I tried that both with notepad++ and Ted Notepad, but neither presents that specific option.

Ted Notepad offers:

ANSI
UTF-8
Unicode
Unicode, Big Endian
BOM (on/off)

Notepad++ offers similar options, but seems to have two Unicode settings named: UCS-2 BE and UCS-2 LE

But neither offers UTF-16

Could that be the problem here?
(probably not, since I have tried all encodings, and none works)
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

2hiccup
Unicode = UTF-16
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
hiccup
Junior Member
Junior Member
Posts: 63
Joined: 2018-05-13, 08:04 UTC

Post by *hiccup »

Ovg wrote:2hiccup
Unicode = UTF-16
Ok,

I tried both Unicode BOM BE and Unicode BOM LE and neither work.

Also I have tried referencing the button to:
AutoHotkey.exe
AutoHotkeyU32.exe
AutoHotkeyU64.exe

In all cases I get "Can't open FilesCopy.ini"
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

I record a gif how it works

https://yadi.sk/i/QRt8nr2Y3VswqL

Check start path in button config - it should be directory with script and ini file

TOTALCMD#BAR#DATA
e:\qqq\www\FilesCopy.ahk
%UL
C:\Program Files\AutoHotkey\AutoHotkey.exe,1
FilesCopy
e:\qqq\www\

-1
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
hiccup
Junior Member
Junior Member
Posts: 63
Joined: 2018-05-13, 08:04 UTC

Post by *hiccup »

Ovg, you are brilliant!

I started again with a clean slate, and now it works perfectly.
I suspect I had made some error in a path or something.

Thanks a million!
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

2hiccup

You are welcome! :D
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
hiccup
Junior Member
Junior Member
Posts: 63
Joined: 2018-05-13, 08:04 UTC

Post by *hiccup »

One more question:

The copying of files is happening in the background. So there is no sign or confirmation that copying is actually being performed, or has succeeded.

Would it be possible to e.g. change something in the script so that the copying process is displayed?
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

2hiccup

I'll think about it, but I can't promise the quick solution ...
Now I am quite busy.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
hiccup
Junior Member
Junior Member
Posts: 63
Joined: 2018-05-13, 08:04 UTC

Post by *hiccup »

No hurry at all, and no pressure.

Thanks to you and other great forum members I have been able to accomplish in 2 days what I was expecting to take me at least a week.
Post Reply