> I've tried the list file/browse file and %Date. The thing is, all my images/videos begins with "yyyyMMdd_HHmmSS".
This looks like the perfect application for Uncle Mikes date formatting task.
This is how I would proceed...
1. Go here..
http://tasker.wikidot.com/getformatteddate
Read the explanations and download the task. Check the user's guide on the Preform task action.
2. Make sure you have de- selected beginners mode tasker preferences
3. In tasker under the task Edit tab ( where you view a list of all your tasks) Long press on the tasks tab.( this will probably be a little different for the new UI but you should be able to locate a menu with the import option)
Select the downloaded task and import it.
4. Now build a simple task to check the dates. It should look something like this..
Task: Get Date
A1. Perform Task [ Name:getFormattedDate Stop:Off Priority:10 Parameter 1 (%par1):%TIMES Parameter 2 (%par2): yyyymmdd Return Value Variable:%filename ]
A2. Flash %filename
5. Now you have today's date in the format as your pics are in. You should be able to use this to match the file names with the "list files" action. Check the user guide under 'pattern matching' but your match should look this.... *%filename* that should list all files with today's date in the file name...
Let me know if you get stuck any where...
Rich..
Hmmmm, there should be a menu that has ' Import' as a option in the task edit tab.. ( It is a long press on the tab that says 'Tasks' in the old UI).. hopefully someone with the new UI can chime in....
Rich..
I've tried to make a file browse and navigate to /storage/emulated/0/DCIM/Camera and that bugs a lot (it leaves out "DCIM" and says it can't find the directory), maybe theres something with tasker, android 4.2 and directory-browsing? Just my random guess..
> Wow, that was fast :). I've tried to go to tasks, push the home-button in lower left
I believe that is a project tab so you are trying to import a project not a task... you need to find the import for the 'tasks'..
It should be in a similar location to this... using a regular file browser..
/mnt/sdcard/Tasker/tasks/
But you need to locate the import task feature in tasker to properly import it.....
Rich..
that works. If you're ever visiting Norway, give me a call so I can buy you a coffe, haha! :)
Deal.... let me know if you get stuck again...
>
> --
> You received this message because you are subscribed to the Google Groups "Tasker" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
> Visit this group at http://groups.google.com/group/tasker?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
. But I tried to use the copy-task, but it seems that it will only copy one instance,
Not sure why you are copying a task.. which task are you trying to copy and why?
do I have to make an array?
The 'list files ' action creates an array..
How can I tell tasker to find only the files from today and copy them to a folder?
Lets start slow... did you get the task I recommended to work and flash today's date in the proper format?
Sorry for me being such a noob. If there's a guide out there I would gladly read it and try to learn by myself so I don't need to bother you guys :)
There is a beginners guide.. I like the pocketables one my self. It should be in the main menu selection..
> Sorry, I meant copy-action.
Copy what?
Also tried to make a list-file action and match %Filename with the a variable I named %CopyDateFiles, when I flash it it only shows the variable as plain text (like this %CopyDateFile)..
The list will be in the ARRAY %CopyDateFiles. Try flashing %CopyDateFiles(:) this should give a comma separated list of the array..
Check array in the user guide under variables..
Btw.. since you are using a global variable the array should be able to be seen in the variables tab with the rest of your global variables.. this is OK for testing but when all is working good you will want to make this a local variable/array....
And then make a
2. "For"-function with variable %FilesToMoved, items:"%FilesToMove()"
3. "Move" from:%FilesToMoved, to:"dropsynctest"
4. "End For"
(Borrowed the move-task from bourne-nolonger at https://groups.google.com/forum/m/?fromgroups#!topic/tasker/nUuFX5gfbwc)
1. Swipe NFC-card
2. Checks if images/videos are created today
3. Copies them to a different folder
4. Syncs the folder with dropbox-folder via dropsync
This is so awesome. Think I owe you a whole trip to Norway, Rich D! :) Now I have to make use the weekend to refine the code. Any tips? :)
> It's alive!
Great.. glad you got it..
> This is so awesome. Think I owe you a whole trip to Norway, Rich D! :)
OK... is this summer good for you?? :)
Now I have to make use the weekend to refine the code. Any tips? :)
Could you post your profile here... Long press on the profile name / ( 3 dot menu with 4.0+ ) export / export description to clipboard (not XML)
The beginner mode needs to be off and the profile needs to have a name to be able to export.
Heres the description. After upload dropsync deletes rhe files in the folder. I wish i could create a notification that the job is done. Thats next on my list.
In advance, sorry for the somewhat lousy programming beneath.
CopyFilesDB (14)
A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%FilesToMove ]
A2: For [ Variable:%FilesToMoved Items:%FilesToMove() ]
A3: Copy File [ From:%FilesToMoved To:dropsynctest Use Root:Off ]
A4: [X] Move [ From:%FilesToMoved To:dropsynctest Use Root:Off ]
A5: End For
A6: Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]
Any input and tips for how the heck I'm supposed to do that would be highly appreciated :)
Oh, it's indeed a pleasure to work with tasker. I'm currently trying to make a system that doesn't need coursing. I'll try to figure out as much as I can by myself, but your input is priceless. It's easier to get that kind of answer and then try to build upon that and learn how to use rhe different actions in tasker :) wish I could buy you a coffee for that answer (and to Rich D)
CopyFilesDB (14)
A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%filestomove ]
A2: For [ Variable:%filestomoved Items:%filestomove() ]
A3: Read File [ File:DBuploadtext/uploads.txt To Var:%readfilesuploaded ]
A4: Copy File [ From:%filestomoved To:dropsynctest Use Root:Off ] If [ %filestomoved() !~ %readfilesuploaded() ]
A5: Write File [ File:DBuploadtext/uploads.txt Text:%filestomoved Append:On Add Newline:On ] If [ %filestomoved() !~ %readfilesuploaded() ]
Could you explain exactly what you are trying to check and why..
Is this to check for.duplicate files from the previous day or to check for duplicate files from the current day or both.. ??
>
> CopyFilesDB (14)
>
> A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%filestomove ]
>
> A2: For [ Variable:%filestomoved Items:%filestomove() ]
>
> A3: Read File [ File:DBuploadtext/uploads.txt To Var:%readfilesuploaded
> A4: Copy File [ From:%filestomoved To:dropsynctest Use Root:Off ] If [ %filestomoved() !~ %readfilesuploaded() ]
In this statement you should be using "%filestomoved" not %filestomoved()
However this will test one array element of %filestomove against the content of the file DBuploadtext/uploads.txt. so I think this action should look like this..
> A4: Copy File [ From:%filestomoved To:dropsynctest Use Root:Off ] If [ *%filestomoved* !~ %readfilesuploaded ]
I am not exactly sure how the "read file" action works as I do not use it often but i believe the way you have it it reads the entire file into the variable but you may have to experiment with it to make sure it is not just reading 1 line of the file...
Rich..
> I`m trying to check for duplicates from the same day. As of now the task copies everything from that day everytime I run it. Since the receiving end deletes the files I`ve uploaded I need to have uploads.txt that can store todays files that`s been uploaded and then check if I`m trying to upload duplicates, and if so, do not copy them to the dropsync-folder.
OK, that makes sense to me now....
As bob said there are several different ways to approach this. This would be mine..
If it just a check for daily uploads I would not use a file to store the file names already up loaded I would just use a global variable. I do not think you will have enough data to warrant using a file. The global variable will make things simpler.
You will need some logic at the beginning of the task to reset the variable each day.. since the list should only be populated with files that match today's date in the format received back from uncle mikes task you should be able to just do a ...
Variable set %Filesmoved To "," ; IF *%Filename* does not match %Filesmoved.
This will put a comma in %Filesmoved which will set it up for easier matching.
Now just append ( with a 'variable set' action withe append ticked) the files that are copied to %Filesmoved with a comma on the end so your %Filesmoved variable will look like this
",first_filename_added,second_filename_added,third_filename_added"
To search the variable your search criteria should look like
If *, %filestomoved,* matches %Filesmoved. Then do stuff....
Let me know if this is not clear...
Rich..
Heres what I got so far:
CopyFilesDB (14)
A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%FilesToMove ]
A2: For [ Variable:%FilesToMoved Items:%FilesToMove() ]
A3: [X] Copy File [ From:%FilesToMoved To:dropsynctest Use Root:Off ]
A4: Variable Set [ Name:%FilesToMoved To:, Do Maths:Off Append:On ] If [ %Filename* !~ %FilesToMoved ]
A5: Flash [ Text:%FilesToMoved Long:Off ]
A6: End For
A7: [X] Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]
A8: [X] Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ]
A9: [X] Say [ Text:Todays images and videos is uploading Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Continue Task Immediately:Off ]
My brain is trying to switch to programming for a couple of days now, but it isn't there quite yet. Even though I try to yell at it :)
No matter what I do now, the For-action will not work. No matter what task I try that has a For-action. Even tasks I knew worked earlier doesn't work with For-anymore. I've even tried to uninstall and reinstall tasker. That helped for a while, but when I tried to make a list-file and then add some other actions it stopped working again, and maaaan I was so near making the task work!! Does it have something to do with Global vs local variables, cause right now im only using global? So frustrating..
and am also not able to put * or , in front of a variable.
Not sure what you mean here.. what happens when you try to put a * in front? ?
> CopyFilesDB (14)
// this action needs to go before the 'for loop' and It should have a different name then the variables you have used so far. This global variable is taking the place of the file you were saving the copied file names too//
> A4: Variable Set [ Name:%Filesmoved To:, Do Maths:Off Append:On ] If [ %Filename* !~ %Filesmoved ]
// //
> A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%FilesToMove ]
I think we need to make the variable names a little easier to understand,
I usually just name the first variable in a for loop %item. It only functions within the 'for loop' so for clarity I think we should change that.
> A2: For [ Variable:%item ; Items:%FilesToMove() ]
// this is where you would put in the check for file names already copied//
> A3: [X] Copy File [ From:%item To:dropsynctest Use Root:Off ]
If *,%item,* does not match %Filesmoved
// //
> A5: Flash [ Text:%item Long:Off ]
> A6: End For
> A7: [X] Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]
> A8: [X] Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ]
> A9: [X] Say [ Text:Todays images and videos is uploading Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Continue Task Immediately:Off ]
>
> My brain is trying to switch to programming for a couple of days now, but it isn't there quite yet. Even though I try to yell at it :)
Try those changes and let me know how it works.... read it carefully as I changed a few things...
Rich..
> You can't put it like this:
> If *, %filestomoved,* matches %Filesmoved. Then do stuff....
> but you can do it like this:
> If %Filesmoved matches *,%filestomoved,*. Then do stuff....
Ahhh, Good catch Bob....
> No matter what I do now, the For-action will not work. No matter what task I try that has a For-action. Even tasks I knew worked earlier doesn't work with For-anymore. I've even tried to uninstall and reinstall tasker. That helped for a while, but when I tried to make a list-file and then add some other actions it stopped working again, and maaaan I was so near making the task work!! Does it have something to do with Global vs local variables, cause right now im only using global? So frustrating..
Most likely the problem... I am not sure you can use a global variable for the first variable in the for loop and there should be no reason to try to use one. This is why I always use %item there... it is only used within the for loop and should be a local variable...
I had to reinstall, stuff works again. I'll try your setup as soon as I can, Rich D :)
> No matter what I do now, the For-action will not work.
OK, here is my best shot at explaining a 'for loop'....
Lets say we have an array with three items in it...
%array1 = red
%array2 = blue
%array3 = green
A for loop needs a comma separated list to function so if we do this..
Variable set %colors to %array()
This sets %colors to "red,blue,green"
So in the for loop action the first thing you set is the variable. This is a local variable that will for each time through the loop equal a incrementally different value from the list.. this is the one I always use %item for..
The next thing you set is the "Items" this is your comma separated list this will be %colors
If we set the for loop like this..
A1. For ( variable: %item / Items: %colors )
A2. Flash %item
A3. Next
The loop will run 3 times because there are three Items in the list and it will flash ..
"red" then "blue" then "green"
Hope this helps..... Rich..
CopyToDB (4)
A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%list ]
A2: For [ Variable:%item Items:%list() ]
A3: Flash [ Text:%item Long:Off ]
A4: Copy File [ From:%item To:dropsynctest Use Root:Off ]
A5: End For
A6: Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]
Sorry, after rereading I realize it was not very clear... lets try it this way..
> CopyToDB (4)
+ A1: Variable Set [ Name:%Filesmoved To:, Do Maths:Off Append:Off ] If [ %Filesmoved !~ *%Filename*]
> A2: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%list ]
> A3: For [ Variable:%item Items:%list() ]
> A4: Flash [ Text:%item Long:Off ]
+ A5: If. %Filesmoved does not match *,%item,*
> A6: Copy File [ From:%item To:dropsynctest Use Root:Off ]
+ A7: Variable set:%Filesmoved To:%item, Append On
+ A8: End If
A9: End For
> A10: Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]
>
Here are the changes that I made...
1. Put the variable set action at action A1. Note that the Append parameter is set to OFF
2. Added a " If " action at action A5:
3. Added a variable set to action A7: Note the comma after the variable %item. So you should enter "%item," (no quotes) in the box and Append is on.
4. Added the action 'End If' at action A8:
5. Renumbered all actions to accommodate new lines..
Hope that is a little clearer .... RICH..
CopyToDBsmart (6)
A1: Variable Set [ Name:%Filesmoved To:, Do Maths:Off Append:Off ] If [ %Filesmoved !~ *%Filename* ]
A2: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%list ]
A3: For [ Variable:%item Items:%list() ]
A4: Flash [ Text:%item Long:Off ]
A5: If [ %Filesmoved !~ *,%item,* ]
A6: Copy File [ From:%item To:dropsynctest Use Root:Off ]
A7: Variable Set [ Name:%Filesmoved To:%item, Do Maths:Off Append:On ]
A8: End If
A9: End For
A10: [X] Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]
> Wow, thats amazing, Thank you. But I can't get it to copy the files to dropsynctest-folder. Checked the log
Do you mean you checked the run log? Did it show actions A6 and A7 running or did it skip from A5 to A9 ?
Did the files copy to the dropsynctest-folder before you changed the code to my suggestions?
What is the value of %Filesmoved when you it in the variables tab ?
To be clear, when you run the task it will flash all of the file names for today but it just does not copy them to dropsynctest-folder. Correct??
I'm trying to try to comprehend the actions you placed and this is really exciting, even though I'm not fully grasping the whole task. Heres what I've done:
It should append the file names of the copied files To the variable %Filesmoved. So if you check the value of %Filemoved in the variables tab it should contain a comma separated list of all the files that were flashed when the task ran. And it should only copy the file if the current file in %item does not match any of the file names is contained in %Filesmoved.
Rich..
But I can't get it to copy the files to dropsynctest-folder.
I found the troublemaker... The problem was the match string we were using *,%item,* contained several " / " symbols. In tasker regular matching the " / " is a "or" symbol and can not be used as a match. I have made this mistake before when dealing with file names but forgot about it. It most likely could be fixed by using regex but I am not that familiar with regex ...
I Had to make the entire task task to figure out the problem so I have posted my working version below.
My solution was to make another variable and replace the "/ " symbol with a " | " symbol for matching purposes....
Copy Pics (275)
A1: Perform Task [ Name:getFormattedDate Stop:Off Priority:10 Parameter 1 (%par1):%TIMES Parameter 2 (%par2):yyyy-mm-dd Return Value Variable:%Filename ]
A2: Flash X [ Text:%Filename Long:Off ]
A3: Variable Set [ Name:%Filesmoved To:, Do Maths:Off Append:Off ] If [ %Filesmoved !~ *%Filename* ]
A4: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%list ]
A5: For [ Variable:%item Items:%list() ]
A6: Variable Set [ Name:%itemreplaced To:%item Do Maths:Off Append:Off ]
A7: Variable Search Replace [ Variable:%itemreplaced Search:/ Ignore Case:Off Multi-Line:On One Match Only:Off Store Matches In: Replace Matches:On Replace With:| ]
A8: Flash [ Text:%itemreplaced Long:Off ]
A9: If [ %Filesmoved !~ *,%itemreplaced,* ]
A10: Flash [ Text:Moved Long:Off ]
A11: Copy File [ From:%item To:dropsynctest Use Root:Off
A12: Variable Set [ Name:%Filesmoved To:%itemreplaced, Do Maths:Off Append:On ]
A13: End If
A14: End For
That should "git r done" .... let me how it works .... Rich..
CopyToDBsmart (4)
A1: Perform Task [ Name:getFormattedDate Stop:Off Priority:10 Parameter 1 (%par1):%TIMES Parameter 2 (%par2):yyyymmdd Return Value Variable:%Filename ]
A2: Flash [ Text:%Filename Long:Off ]
A3: Variable Set [ Name:%Filesmoved To:, Do Maths:Off Append:Off ] If [ %Filesmoved !~ *%Filename* ]
A4: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%list ]
A5: For [ Variable:%item Items:%list() ]
A6: Variable Set [ Name:%itemreplaced To:%item Do Maths:Off Append:Off ]
A7: Variable Search Replace [ Variable:%itemreplaced Search:/ Ignore Case:Off Multi-Line:On One Match Only:Off Store Matches In: Replace Matches:On Replace With:| ]
A8: Flash [ Text:%itemreplaced Long:Off ]
A9: If [ %Filesmoved !~ *,%itemreplaced,* ]
A10: Flash [ Text:moved Long:Off ]
A11: Copy File [ From:%item To:dropsynctest Use Root:Off ]
A12: Variable Set [ Name:%Filesmoved To:%itemreplaced Do Maths:Off Append:On ]
A13: End If
A14: End For
A15: [X] Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]
Once again, Rich, thank you so much!
> A12: Variable Set [ Name:%Filesmoved To:%itemreplaced Do Maths:Off Append:On ]
You missed a comma here...
It needs to be "%itemreplaced," no quotes.