Hi guys!
I want to make a script that make this: when i select a track from windows explorer by left clicking it or by simple navigating with arrows -> open the file selected in the same window of Spek ( http://spek.cc/ ).
I would appreciate if someone can help me
Open selected file in SPEK
Re: Open selected file in SPEK
The webpage(s) aren't providing any in-detail information eg. how to hand over a selected file (beside drag & drop).
Re: Open selected file in SPEK
Yeah. That's the problem . It's not single instance.
If we do not take this into account, how should my script look like?
Something like this ? but it doesn't work. it pops an error message.
If we do not take this into account, how should my script look like?
Something like this ? but it doesn't work. it pops an error message.
Code: Select all
Clipboard =
Send ^c
ClipWait ;waits for the clipboard to have content
Run, C:\Program Files (x86)\Spek\spek.exe `"%clipboard%`"
return
Re: Open selected file in SPEK
Would you mind to post spek's command line parameters?! Thx.
Code: Select all
Clipboard =
Send ^c
ClipWait ; waits for the clipboard to have content
Run, % "C:\Program Files (x86)\Spek\spek.exe " """" . clipboard . """"
Return
Re: Open selected file in SPEK
It does not hove. This is all i found: (a --help and --version option)
http://spek.cc/man-0.8.2.html
Also i found it's source code on github, it's coded in C++ : https://github.com/alexkay/spek
http://spek.cc/man-0.8.2.html
Also i found it's source code on github, it's coded in C++ : https://github.com/alexkay/spek
Re: Open selected file in SPEK
I put some information here about how to programmatically drag-and-drop a file into a program, in case that helps:
Open multiple files by shortcut in a program (MP3TAG) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 07#p160107
It works by creating an hDrop and using WM_DROPFILES.
Open multiple files by shortcut in a program (MP3TAG) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 07#p160107
It works by creating an hDrop and using WM_DROPFILES.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Open selected file in SPEK
So, this is the code that jeeswg postet:
I receive an error message
Code: Select all
q::
WinGet, hWnd, ID, A
vPaths := Clipboard
;vPaths := A_ScriptFullPath
PostMessage, 0x233, % JEE_DropCreate(vPaths), 0,, % "ahk_id " hWnd ;WM_DROPFILES := 0x233
return
;get 'JEE_DropCreate' from:
;notepad get/set path (get/set text file path) - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=30050
Re: Open selected file in SPEK
You need to copy and paste the code for the function into your script.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Open selected file in SPEK
The first error message is: " C:\Program Files (x86)\Mp3tag\JEE_DropCreate(vPaths, vPosX=0, vPosY=0) was not found". Is this because i have extended monitors? Mp3tag window is on the main display tho.
With Spek nothing happens.
With Spek nothing happens.
Re: Open selected file in SPEK
Unfortunately this didn't work when I tested. A workaround would be to trigger the Open menu and put a path there.
Code: Select all
#IfWinActive, ahk_class CabinetWClass
^q::
#IfWinActive, ahk_class ExploreWClass
^q::
Clipboard := ""
Send, ^c
ClipWait
vPath := Clipboard
if FileExist(vPath)
{
WinActivate, Spek - ahk_class wxWindowNR
WinWaitActive, Spek - ahk_class wxWindowNR
PostMessage, 0x233, % JEE_DropCreate(vPath), 0,, Spek - ahk_class wxWindowNR ;WM_DROPFILES := 0x233
}
MsgBox, % "done"
return
#IfWinActive
;==================================================
;e.g. hDrop := JEE_DropCreate(vPaths)
;where vPaths is an LF/CRLF-separated list
;JEE_HDropSetPaths
JEE_DropCreate(vPaths, vPosX=0, vPosY=0)
{
;GMEM_ZEROINIT := 0x40, GMEM_MOVEABLE := 0x2
vWidth := A_IsUnicode?2:1
hDrop := DllCall("GlobalAlloc", UInt,0x42, UPtr,20+(StrLen(vPaths)+2)*vWidth, Ptr)
pDrop := DllCall("GlobalLock", Ptr,hDrop)
;DROPFILES struct
NumPut(20, pDrop+0, 0, "UInt")
NumPut(vPosX, pDrop+4, 0, "UInt")
NumPut(vPosY, pDrop+8, 0, "UInt")
NumPut(A_IsUnicode?1:0, pDrop+16, 0, "UInt")
;e.g. CF_HDROP with 3 paths: 'path1 null path2 null path3 null null'
vOffset := 20
Loop, Parse, vPaths, `n, `r
if !(A_LoopField = "")
{
DllCall("RtlMoveMemory", UInt,pDrop+vOffset, Str,A_LoopField, UInt,StrLen(A_LoopField)*vWidth)
vOffset += (StrLen(A_LoopField)+1)*vWidth
}
DllCall("GlobalUnlock", Ptr,hDrop)
return hDrop
}
Last edited by jeeswg on 20 Jul 2017, 11:53, edited 2 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Open selected file in SPEK
"..., when i select a track from windows explorer ..."
BTW, what file format are we talking about?
BTW, what file format are we talking about?
Re: Open selected file in SPEK
All it does is to reposition my window. And now when i press Q in Mp3tag window ..it shows me: "C:\Program FIles (x86)\Mp3tag\All it does is to reposition my window".
hmmm it seems that in clipboard it saves what text I save with "ctrl + c"
hmmm it seems that in clipboard it saves what text I save with "ctrl + c"
Re: Open selected file in SPEK
OK, this should work:
A simpler alternative, which closes the window, instead of trying to reuse an existing one:
Code: Select all
#IfWinActive, ahk_class CabinetWClass
^q:: ;explorer - open selected file in SPEK
#IfWinActive, ahk_class ExploreWClass
^q:: ;explorer - open selected file in SPEK
Clipboard := ""
Send, ^c
ClipWait
vPath := Clipboard
if !FileExist(vPath)
return
WinGet, hWnd, ID, Spek - ahk_class wxWindowNR
if !hWnd
{
Run, "C:\Program Files (x86)\Spek\spek.exe" "%vPath%"
return
}
WinActivate, % "ahk_id " hWnd
WinWaitActive, % "ahk_id " hWnd
PostMessage, 0x111, 5000,,, % "ahk_id " hWnd ;WM_COMMAND
WinWaitActive, Open File ahk_class #32770 ahk_exe spek.exe
WinGet, hWnd2, ID, Open File ahk_class #32770 ahk_exe spek.exe
ControlSetText, Edit1, % vPath, % "ahk_id " hWnd2
ControlClick, Button1, % "ahk_id " hWnd2
return
#IfWinActive
Code: Select all
#IfWinActive, ahk_class CabinetWClass
^q:: ;explorer - open selected file in SPEK
#IfWinActive, ahk_class ExploreWClass
^q:: ;explorer - open selected file in SPEK
Clipboard := ""
Send, ^c
ClipWait
vPath := Clipboard
if !FileExist(vPath)
return
WinGet, hWnd, ID, Spek - ahk_class wxWindowNR
if hWnd
{
WinClose, % "ahk_id " hWnd
WinWaitClose, % "ahk_id " hWnd
}
Run, "C:\Program Files (x86)\Spek\spek.exe" "%vPath%"
return
#IfWinActive
Last edited by jeeswg on 20 Jul 2017, 13:05, edited 1 time in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Open selected file in SPEK
It has no effect
Re: Open selected file in SPEK
I've amended the script above to open SPEK if it's not already open, and I've added a slightly simpler script just below it.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Open selected file in SPEK
I came back with update. I think I didn't done something right, I apologize
So, for the last 3 codes that you gave me, we have:
1. With Spek not open -> it doesn't work. With Spek already open, when i press CTRL+Q on a selected file it will just show me a message box with "done".
2. Is workin' like you said it's trigger the Open menu and put a path there. it happen very fast but it's noticeable. (works for both cases: already opened speak or not)
3. this is working too. but because is closes the window and not reuse an existing one, automatically will reset the position and the size of the window.
I really like the second script you've made because it keeps the original position and size of the window. Also is faster. The only "downside" is that is a little noticeable the fact that you trigger the Open menu. if you could "make it invisible" it will be perfect <3 .
There are some small improvements which I would love to see implemented, if you want to help me with them : to make it work when a file is selected (by simple click or by arrows - without keyboard shortcut) && only when Speak is already open. (if i close SPEK the "select file <-> open in speak thing" must not work)
For Bobo: I talked about : mp3s, flac, wavs, aiff, aif, mp4, ogg . I think that's all i use. By the way, can you restrict to open just these types of files?
Also i found that it doesn't work with files that are on Desktop.
Maaaaan, I'm very glad you've managed to find a way to solve the problem. In my eyes you are a genius ) !!
(Sorry for my english. It's not my native language )
So, for the last 3 codes that you gave me, we have:
1. With Spek not open -> it doesn't work. With Spek already open, when i press CTRL+Q on a selected file it will just show me a message box with "done".
2. Is workin' like you said it's trigger the Open menu and put a path there. it happen very fast but it's noticeable. (works for both cases: already opened speak or not)
3. this is working too. but because is closes the window and not reuse an existing one, automatically will reset the position and the size of the window.
I really like the second script you've made because it keeps the original position and size of the window. Also is faster. The only "downside" is that is a little noticeable the fact that you trigger the Open menu. if you could "make it invisible" it will be perfect <3 .
There are some small improvements which I would love to see implemented, if you want to help me with them : to make it work when a file is selected (by simple click or by arrows - without keyboard shortcut) && only when Speak is already open. (if i close SPEK the "select file <-> open in speak thing" must not work)
For Bobo: I talked about : mp3s, flac, wavs, aiff, aif, mp4, ogg . I think that's all i use. By the way, can you restrict to open just these types of files?
Also i found that it doesn't work with files that are on Desktop.
Maaaaan, I'm very glad you've managed to find a way to solve the problem. In my eyes you are a genius ) !!
(Sorry for my english. It's not my native language )
Re: Open selected file in SPEK
Just fo the records, wav + aiff are handled by sndpeek as well: http://autohotkey.com/boards/viewtopic.php?f=22&t=34759
Re: Open selected file in SPEK
Bobo sndpeek is real-time and i don't need real time . Also i find that SPEK's frequency spectrum is the most accurate of all.
Bobo can you help me to make this changes to the script?
- I want to go through the files with the arrows keys (or by simply clicking on a file), and the file that is current selected to update automatically (open in) the SPEK window. The actual script changes the Active window TO Spek window. so i can't move anymore through explorer window. in order to do that i have to select the Explorer window where the file that opened in SPEK was selected.
- makes this script work only when Speak is already open.
Here's the script that jeeswg made:
Bobo can you help me to make this changes to the script?
- I want to go through the files with the arrows keys (or by simply clicking on a file), and the file that is current selected to update automatically (open in) the SPEK window. The actual script changes the Active window TO Spek window. so i can't move anymore through explorer window. in order to do that i have to select the Explorer window where the file that opened in SPEK was selected.
- makes this script work only when Speak is already open.
Here's the script that jeeswg made:
Code: Select all
#IfWinActive, ahk_class CabinetWClass
^q:: ;explorer - open selected file in SPEK
#IfWinActive, ahk_class ExploreWClass
^q:: ;explorer - open selected file in SPEK
Clipboard := ""
Send, ^c
ClipWait
vPath := Clipboard
if !FileExist(vPath)
return
WinGet, hWnd, ID, Spek - ahk_class wxWindowNR
if !hWnd
{
Run, "C:\Program Files (x86)\Spek\spek.exe" "%vPath%"
return
}
WinActivate, % "ahk_id " hWnd
WinWaitActive, % "ahk_id " hWnd
PostMessage, 0x111, 5000,,, % "ahk_id " hWnd ;WM_COMMAND
WinWaitActive, Open File ahk_class #32770 ahk_exe spek.exe
WinGet, hWnd2, ID, Open File ahk_class #32770 ahk_exe spek.exe
ControlSetText, Edit1, % vPath, % "ahk_id " hWnd2
ControlClick, Button1, % "ahk_id " hWnd2
return
#IfWinActive
Re: Open selected file in SPEK
I manage to make the fallowing:
- make this script work only when Speak is already open. (i've deleted "Run, "C:\Program Files (x86)\Spek\spek.exe" "%vPath%"")
- change the active window back to the window where the file that opened in SPEK was selected.
Now i'm wondering how to make it work in the way that i can go through the files with the arrows keys (or by simply clicking on a file), and the file that is current selected to update automatically (open in) the SPEK window.
Also i want to restrict the files that are opened in spek to this extensions: wav, aiff, aif, flac, mp3, ogg, mp4.
Hope that you guys can help me to finish this script
P.S: I wonder if i could use this script to make it work inside MediaMonkey player, in the same way that works in Window Explorer.
(Also I'm thinking of another approach if I can't solve it like that. I spoke to a friend who knows C ++ and we want to make some changes to the program itself. It's open source: https://github.com/alexkay/spek
So we have 2 alternatives:
1. force Spek to be one instance and open all files in the same window. (but what if i want someday to open a second window? it will be possible ?)
2. enable a Open File command line
- make this script work only when Speak is already open. (i've deleted "Run, "C:\Program Files (x86)\Spek\spek.exe" "%vPath%"")
- change the active window back to the window where the file that opened in SPEK was selected.
Code: Select all
#IfWinActive, ahk_class CabinetWClass
q:: ;explorer - open selected file in SPEK
WinGet, curent, ID, A
Clipboard := ""
Send, ^c
ClipWait
vPath := Clipboard
if !FileExist(vPath)
return
WinGet, hWnd, ID, Spek - ahk_class wxWindowNR
if !hWnd
{
return
}
WinActivate, % "ahk_id " hWnd
WinWaitActive, % "ahk_id " hWnd
PostMessage, 0x111, 5000,,, % "ahk_id " hWnd ;WM_COMMAND
WinWaitActive, Open File ahk_class #32770 ahk_exe spek.exe
WinGet, hWnd2, ID, Open File ahk_class #32770 ahk_exe spek.exe
ControlSetText, Edit1, % vPath, % "ahk_id " hWnd2
ControlClick, Button1, % "ahk_id " hWnd2
WinActivate, % "ahk_id " curent
return
#IfWinActive
Also i want to restrict the files that are opened in spek to this extensions: wav, aiff, aif, flac, mp3, ogg, mp4.
Hope that you guys can help me to finish this script
P.S: I wonder if i could use this script to make it work inside MediaMonkey player, in the same way that works in Window Explorer.
(Also I'm thinking of another approach if I can't solve it like that. I spoke to a friend who knows C ++ and we want to make some changes to the program itself. It's open source: https://github.com/alexkay/spek
So we have 2 alternatives:
1. force Spek to be one instance and open all files in the same window. (but what if i want someday to open a second window? it will be possible ?)
2. enable a Open File command line
Re: Open selected file in SPEK
Code: Select all
#SingleInstance, Force
i := 1
extIndex := "wav,aiff,aif,flac,mp3,ogg,mp4"
!c:: ; press ALT + C to copy the path of all selected files (from Explorer) to the clipboard
ClipBoard := ""
Send, ^c
ClipWait
ClipBoard := ClipBoard
; MsgBox % Clipboard
filePath := StrSplit(ClipBoard,"`n")
Return
#s:: ; press Winkey + S every time you wanna call one of the selected files
If (i > filePath.MaxIndex()){
i := 1
MsgBox % "Adios Muchacho!"
Return
}
SplitPath,% filepath[i],,,ext
If !InStr(extIndex,ext){
i++
Return
}
MsgBox % "Run, spek " filePath[i] ; replace this line with a valid 'spek' command line
i++
Return
Who is online
Users browsing this forum: No registered users and 121 guests