Gio710 > 2022-07-17 23:32
c:
cd \
echo List files in %1
dir %1
pause
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode,2
; #Persistent
#SingleInstance Force
#WinActivateForce
Sysget, totalWidth, 78
Sysget, totalHeight, 79
MsgBox %1%
Loop, %0% ; For each parameter:
{
param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
MsgBox, 4,, Parameter number %A_Index% is %param%. Continue?
IfMsgBox, No
break
}
; msgbox %explorerpath%
for n, param in A_Args ; For each parameter:
{
explorerpath = %param%
}
; explorerpath = %A_ScriptDir%
Msgbox before %explorerpath%
DetectCtrKeyIsDown := GetKeyState(LCtrl , P)
Msgbox after : %DetectCtrKeyIsDown%
Return
Jean Lalonde > 2022-07-18 07:12
Jean Lalonde > 2022-08-02 13:20
Gio710 > 2022-08-06 12:57
(2022-08-02 13:20)Jean Lalonde Wrote: Hi Gio710,
Sorry, I looked at your script and could not understand what you are trying to do exactly and I don't have much time to investigate this. Does your script run correctly from the command-line (without QAP)? If yes, give an example of the command line and parameters running your script. With this, it could be easier to help you integrate this in QAP.
Also, if you need more help on AHK scripting, I recommend asking the AHK forum where there are more people able to help you.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode,2
; #Persistent
#SingleInstance Force
#WinActivateForce
Sysget, totalWidth, 78
Sysget, totalHeight, 79
; This Macro is made to send selected file in win explorer to the QAP folder that will be selected
; example : if I scan my bills, and that these scans are written a window folder
; I will use the various folders for different bills type, that I put in a QAP menu
; So when I have finished scanning my bills, then I will select them one by one
; then, while maintaining Left ctrl pressed, I'll launch QAP with middle mouse button
; select the destination folder for my selected file
; Therefore, I need to be able to send the folder path as a parameter to this macro
; when this macro receives the path as a parameter AND Left ctrl stay pressed,
; this ahk macro sends selected file to the destination folder
FNBR := WinExplorer_GetSelectionDirAndPath()
; MsgBox paramètre 1 - %1%
; Loop, %0% ; For each parameter:
; {
; param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
; ; MsgBox, 4,, Parameter number %A_Index% is %param%. Continue?
; ; IfMsgBox, No
; ; break
; }
; msgbox %explorerpath%
for n, param in A_Args ; For each parameter:
{
PathToMoveSelectionTo = %param%
}
; explorerpath = %A_ScriptDir%
if GetKeyState("LCtrl") ; LControl is still down.
MsgBox La touche contrôle est restée appuyée`n=> Depuis QAP, le dossier vers lequel envoyer la sélection est %PathToMoveSelectionTo%
FileMove, % FNBR.Path, % PathToMoveSelectionTo, 1
return ; Do nothing.
; Msgbox after : %DetectCtrKeyIsDown%
Return
WinExplorer_GetSelectionDirAndPath(hwnd="") {
WinGet, process, processName, % "ahk_id" hwnd := hwnd? hwnd:WinExist("A")
WinGetClass class, ahk_id %hwnd%
if (process = "explorer.exe")
if (class ~= "(Cabinet|Explore)WClass") {
for window in ComObjCreate("Shell.Application").Windows
if (window.hwnd==hwnd)
FilePath := window.Document.FocusedItem.path
SplitPath, FilePath, FileNameExt, FileDir, XT, FileNameNoExt
; msgbox FilePath=%FilePath%`n`nFileNameExt=%FileNameExt%`n`nFileDir=%FileDir%`n`nExtension=%XT%`n`nFileNameNoExt=%FileNameNoExt%
; return
; FilePath == absolute path with name and extension
; FileDir == absolute path without name ;
; FileNameExt == File Name, with extension included
; FileNameNoExt == File Name, without extension
; FileNameExt := FileNameNoExt . "." . XT
}
Sel:={Dir: FileDir, NameNo: FileNameNoExt, NameExt: FileNameExt, Path: FilePath, Ext: XT}
return Sel
}
Jean Lalonde > 2022-08-06 13:44
Gio710 > 2022-08-20 07:51
Jean Lalonde > 2022-08-20 13:08