Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Copy selected files (not only one)



  • Please log in to reply
4 replies to this topic
Dogway
  • Members
  • 39 posts
  • Last active: Jan 04 2015 01:48 AM
  • Joined: 04 Feb 2012

I managed to build this script, the problem is it only works with single files, i need to copy ALL the selected files, then when copied run them with MPC-HC. I guess a loop function must be called somewhere:

joy7 & joy5::
     if (GetKeyState("joy5", "T")) && (GetKeyState("joy7", "T"))
{
  WinGetClass   ,explorerClass,A
  ControlGetText,currentPath , Edit1,ahk_class %explorerClass%
  ControlGet    ,selectedFile, List,Selected Col1,SysListView321,ahk_class %explorerClass%
  f=%selectedFile%
  p=%currentPath%\f

        FileCopy, %p%, E:\HTPC.Temp, %DoOverwrite%
        run, "C:\Archivos de programa\MPC-HC.1.6.7.6967.x86.Lite\mpc-hc.exe" %f%  /fullscreen
        Sleep, 1000
}


garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005

example copy filenames to clipboard

;- open folder and mark files then press F9

F9::
  WinGetClass   ,explorerClass,A
  ControlGetText,currentPath , Edit1,ahk_class %explorerClass%
  ControlGet    ,selectedFile, List,Selected Col1,SysListView321,ahk_class %explorerClass%
  I=0
  ;----------------------------
  Loop,Parse,selectedfile, `n
   {
   c:=(A_LoopField)
   k=%currentPath%\%c%
   if (c="")
      break
   if (k="" or k="\")
      continue
   SplitPath,K, name, dir, ext, name_no_ext, drive
     {
     j .=k "`n"
     n .=name "`n"
     }
   i++
   }
  ;----------------------------
 msgbox, 262208, ,Copied to Clipboard %i%-Files=`n%j%`nNAME=`n%n%
 clipboard:=j
 i=
 j=
 return

can also use M3U file to play video or music

;--- M3Ux create a M3U file ---------------
;- vlc.exe plays video and audio with file xy.m3u

MODIFIED=20111204
setworkingdir,%a_scriptdir%
PRESELECT=C:\M_VIDEO\               ;--- search from here
FileSelectFolder,MF,%PRESELECT%
if MF=
  return
SplitPath,MF, name, dir, ext, name_no_ext, drive
F1=%A_desktop%\%name_no_ext%.m3u
ifexist,%f1%
  filedelete,%f1%
setworkingdir,%MF%
runwait,%comspec% /c dir /b /s *.mp4 >"%F1%",,hide
runwait,%comspec% /c dir /b /s *.flv >>"%F1%",,hide
run,%f1%
exitapp



Dogway
  • Members
  • 39 posts
  • Last active: Jan 04 2015 01:48 AM
  • Joined: 04 Feb 2012

Thanks a bunch, I managed to implement the first part. The m3u playlist script is a great idea, I didn't pretend to go so far but it would be the ideal workflow, unfortunately I couldn't adapt the script to my needs, here there is another method although a bit more complicated. This is what I got so far:

joy7 & joy5::
     if (GetKeyState("joy5", "T")) && (GetKeyState("joy7", "T"))
{
  WinGetClass   ,explorerClass,A
  ControlGetText,currentPath , Edit1,ahk_class %explorerClass%
  ControlGet    ,selectedFile, List,Selected Col1,SysListView321,ahk_class %explorerClass%
  I=0
  ;----------------------------
  Loop,Parse,selectedfile, `n
   {
   c:=(A_LoopField)
   k=%currentPath%\%c%
   if (c="")
      break
   if (k="" or k="\")
      continue
   SplitPath,K, name, dir, ext, name_no_ext, drive
     {
     j .=k "`n"
     n .=name "`n"
     }
   i++
		FileCopy, %k%, E:\HTPC.Temp, %DoOverwrite%
   }
  ;----------------------------
        run, "C:\Archivos de programa\MPC-HC.1.6.7.6967.x86.Lite\mpc-hc.exe" "E:\HTPC.Temp\%n%"  /fullscreen
        Sleep, 1000
}


Dogway
  • Members
  • 39 posts
  • Last active: Jan 04 2015 01:48 AM
  • Joined: 04 Feb 2012
✓  Best Answer

after a lot of testing I got a code that works without the need of a playlist, it's not as elegant but works. Basically it runs the first file, when you close the player, it plays the second, and so on, thanks to runwait.

joy7 & joy5::
     if (GetKeyState("joy5", "T")) && (GetKeyState("joy7", "T"))
{
  WinGetClass   ,explorerClass,A
  ControlGetText,currentPath , Edit1,ahk_class %explorerClass%
  ControlGet    ,selectedFile, List,Selected Col1,SysListView321,ahk_class %explorerClass%
  I=0
  ;----------------------------
  Loop,Parse,selectedfile, `n
   {
   c:=(A_LoopField)
   k=%currentPath%\%c%
   if (c="")
      break
   if (k="" or k="\")
      continue
   SplitPath,K, name, dir, ext, name_no_ext, drive
     {
     j .=k "`n"
     n .=name "`n"
     }
   i++
		FileCopy, %k%, E:\HTPC.Temp, %DoOverwrite%
        runwait, "C:\Archivos de programa\MPC-HC.1.6.7.6967.x86.Lite\mpc-hc.exe" "E:\HTPC.Temp\%c%"  /fullscreen
        Sleep, 1000
   }
}


garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005

thank you Dogway

here just another example

;- idea  = open Folder with videos ( or music )  , mark a few or all files , press F9 , plays selected videos ( or music )
;- button ESC  >>  close player and exit
;- player = %fp% ( mpc-hc.exe )  / windows XP netbook / AHK_Basic or AHK_L

MODIFIED=20140227
setworkingdir,%a_scriptdir%

fp=%a_programfiles%\Media Player Classic - Home Cinema\mpc-hc.exe
SplitPath,fp, name, dir, ext, name_no_ext, drive

PRESELECT=C:\M_VIDEO\               ;--- search from here
FileSelectFolder,MF,%PRESELECT%
if mf=
  exitapp
run,%mf%                            ;- open selected folder / then mark files / then press F9
return


F9::
if mf=
 return
{
  WinGetClass   ,explorerClass,A
  ControlGetText,currentPath , Edit1,ahk_class %explorerClass%
  ControlGet    ,selectedFile, List,Selected Col1,SysListView321,ahk_class %explorerClass%
  Loop,Parse,selectedfile, `n
   {
   c:=(A_LoopField)
   k=%currentPath%\%c%
   if (c="")
      break
   if (k="" or k="\")
      continue
   runwait,%fp% "%k%"    ;- play selected video/music-file then continue
   }
}
exitapp
return

;--- button ESC >> close player and exit script -- 
esc::
{
process,exist,%name%
if errorlevel
  process,close,%name%
process,waitclose,%name%
exitapp
}
return
;=================== end sript ====================