Jump to content

arrays / delimiters


shotiko
 Share

Recommended Posts

hello autoit community...

I've been troubling with some script for my program that opens torrent files automatically from a directory and uses third-party search software to search for its destination folder which is already on the hard drive. this will benefit hundreds or thousands of torrents you could have on your hard drive and want to seed but it takes loads of time doing all manually.

it will help building up torrent clients after OS reinstallation, moving Exteral HD from one computer to another, moving from different clients to utorrent( :)).

what i need is to get last folder name from the path(ex. F:folder1folder2folder3folder4folder5Aarktica - In Sea (2009) - FLAC)

in above case "album", copied to the clipboard

i've though of stringsplit and stringtrim but couldnt make much out of them.

i guess it should be done with arrays* and splitting them with " " delimiter and copying last string from " " to clipboard

*NOTE: number of folders change so does " "

I have basic script ready and I'm stuck on the challenging one

here is the script:

WinActivate(".torrent folder");activate window ".torrent folder"
ControlFocus("[CLASS:CabinetWClass]","","DirectUIHWND3");focus window frame with files (which might not be necessary)
WinWaitActive(".torrent folder");wait until window ".torrent folder" is activated

Send("{HOME}",0);hit home to select first torrent file
send("{enter}",0);hit enter
WinActivate("[CLASS:#32770]");activate windows "add new torrent"
ControlFocus("", "add new torrent", "ComboBox1");focus/select on torrent path
WinWaitActive("[CLASS:#32770]","")
$clipread=Send("^c",0);copy selection to clipboard

so far it opens torrent folder. starts selects first file in the folder and opens in utorrent

Posted Image

now focuses path bar and copys it to clipboard.

but i only need last part of the string copied which is after last delimiter " " (which usually is the folder name of the downloading torrent)

Edited by shotiko
Link to comment
Share on other sites

I've actually done a lot of path grabbing before. The easiest way I've found is:

$sPath = "C:Documents and SettingstestMy DocumentstestTest Archivetest2test4CellTest.txt"
$aPath = StringSplit($sPath,"")
$sResult = $aPath[$aPath[0]]
ConsoleWrite($sResult & @CR)

Returns the last array entry.

- Fett

Edited by fett8802
[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...