Skip to main content
Correcting grammar.
Source Link
Trebor Rude
  • 1.1k
  • 8
  • 23

You can use a Variable Split action with a splitter of / to get the pieces, then use %VAR(<) to get the filename. If the fact that the full filename is in an array already gives you problems, copy the array element into a non-array variable first.

From youyour comments, it sounds like you have this code:

List files Dir /storage/Tasker/project/test/ Variable %files match *.wav
For Variable %files Items %files()
  Variable Split Name %files Splitter /
  Popup Text %files(<)
End For

It's probably not a good idea to use %files as both the "Variable" and the "Items" portion of the For loop. Try using %file for the Variable, then replace all references to %files inside the loop with %file.

Please correct me if I've not captured your code correctly.

You can use a Variable Split action with a splitter of / to get the pieces, then use %VAR(<) to get the filename. If the fact that the full filename is in an array already gives you problems, copy the array element into a non-array variable first.

From you comments, it sounds like you have this code:

List files Dir /storage/Tasker/project/test/ Variable %files match *.wav
For Variable %files Items %files()
  Variable Split Name %files Splitter /
  Popup Text %files(<)
End For

It's probably not a good idea to use %files as both the "Variable" and the "Items" portion of the For loop. Try using %file for the Variable, then replace all references to %files inside the loop with %file.

Please correct me if I've not captured your code correctly.

You can use a Variable Split action with a splitter of / to get the pieces, then use %VAR(<) to get the filename. If the fact that the full filename is in an array already gives you problems, copy the array element into a non-array variable first.

From your comments, it sounds like you have this code:

List files Dir /storage/Tasker/project/test/ Variable %files match *.wav
For Variable %files Items %files()
  Variable Split Name %files Splitter /
  Popup Text %files(<)
End For

It's probably not a good idea to use %files as both the "Variable" and the "Items" portion of the For loop. Try using %file for the Variable, then replace all references to %files inside the loop with %file.

Please correct me if I've not captured your code correctly.

Added information from comments.
Source Link
Trebor Rude
  • 1.1k
  • 8
  • 23

You can use a Variable Split action with a splitter of / to get the pieces, then use %VAR(<) to get the filename. If the fact that the full filename is in an array already gives you problems, copy the array element into a non-array variable first.

From you comments, it sounds like you have this code:

List files Dir /storage/Tasker/project/test/ Variable %files match *.wav
For Variable %files Items %files()
  Variable Split Name %files Splitter /
  Popup Text %files(<)
End For

It's probably not a good idea to use %files as both the "Variable" and the "Items" portion of the For loop. Try using %file for the Variable, then replace all references to %files inside the loop with %file.

Please correct me if I've not captured your code correctly.

You can use a Variable Split action with a splitter of / to get the pieces, then use %VAR(<) to get the filename. If the fact that the full filename is in an array already gives you problems, copy the array element into a non-array variable first.

You can use a Variable Split action with a splitter of / to get the pieces, then use %VAR(<) to get the filename. If the fact that the full filename is in an array already gives you problems, copy the array element into a non-array variable first.

From you comments, it sounds like you have this code:

List files Dir /storage/Tasker/project/test/ Variable %files match *.wav
For Variable %files Items %files()
  Variable Split Name %files Splitter /
  Popup Text %files(<)
End For

It's probably not a good idea to use %files as both the "Variable" and the "Items" portion of the For loop. Try using %file for the Variable, then replace all references to %files inside the loop with %file.

Please correct me if I've not captured your code correctly.

Source Link
Trebor Rude
  • 1.1k
  • 8
  • 23

You can use a Variable Split action with a splitter of / to get the pieces, then use %VAR(<) to get the filename. If the fact that the full filename is in an array already gives you problems, copy the array element into a non-array variable first.