FAQs: TC Skripten für jede Datei // TC scripting for each file

English support forum

Moderators: sheep, Hacker, Stefan2, white

Post Reply
User avatar
Stefan2
Power Member
Power Member
Posts: 3078
Joined: 2007-09-13, 22:20 UTC
Location: Europa

FAQs: TC Skripten für jede Datei // TC scripting for each file

Post by *Stefan2 »

DEUTSCH
Der TC stellt dir eine temporäre Liste aller ausgewählten Dateien und Ordner\ bereit.
(Ordner haben einen abschließenden Backslash, daran kann man sie erkennen)

Rechts klicke auf irgendeinen Button in der Button-Leiste und wähle "Ändern..."
Im Buttondialog klicke auf [Hilfe] und lese "Dialogbox: Konfigurieren - Buttonbar ändern"
%L, %l, %F, %f, %D, %d, %WL, %WF, %UL, %UF
erzeugt im TEMP-Verzeichnis einen Listendatei mit den Namen der markierten Dateien und Verzeichnisse,
und fügt den Namen der Listendatei in die Kommandozeile ein.
Die Liste wird nach Beendigung des Programms von Total Commander gelöscht.
Es können 10 verschiedene Arten von Listen erzeugt werden:
%L Lange Dateinamen inkl. kompletten Pfads, z. B. c:\Eigene Dateien\langer Name.txt
%F Lange Dateinamen ohne Pfad, z. B. langer Name.txt
%UL, %UF >> UTF-8-Unicode-Listendatei (mit Byteordermarker)
%WL, %WF >> UTF-16-Unicode-Listendatei (mit Byteordermarker)

ENGLISH
TC prodices you an temporarly list of all selected files and directories\.
(dirs have an trailing backslash, so you can detect them)

Right click any button in the buttonbar and chose "Change..."
In the button dialog click the [Help] button and read "Dialog box: Configuration - Change button bar"

%L, %l, %F, %f, %D, %d, %WL, %WF, %UL, %UF
create a list file in the TEMP directory with the names of the selected files and directories,
and appends the name of the list file to the command line.
The list is deleted automatically when the called program quits.
10 types of list files can be created:
%L Long file names including the complete path, e.g. c:\Program Files\Long name.exe
%F Long file names without path, e.g. Long name.exe
%UL,%UF >> UTF-8 Unicode list file (with byte order mark)
%WL,%WF >> UTF-16 Unicode list file (with byte order mark)




TEST

Test button:

Menü "Konfigurieren > Buttonbar ändern..." // Klicke auf [Anfügen] // Trage die Daten ein // [OK] (oder kopiere dir den Exchangeable Button-Code unten)
Menu "Configuration > Button bar…" // Click at [Add] // fill in the properties // [OK] (or copy the Exchangeable Button-Code from below)

Code: Select all

Command: cmd /c
Parameters: Notepad "%WL"
Start path:
Icon file: wcmicons.dll
Tooltip: Show temporary text file with selected files
Für englische Buchstaben A-Z reicht ein %L, um mit deutschen Umlauten zu arbeiten verwende %WL oder ein kleines L: %l (siehe Hilfe im TC, wie oben erklärt).


Exchangeable Button-Code for "Test button":

Code: Select all

TOTALCMD#BAR#DATA
cmd /k
Notepad "%WL"
wcmicons.dll,9
Show temporary text file with selected files

0
-1
Austauschbarer Button-Code // Exchangeable Button-Code:
Anwendung: markiere den Code, kopiere ihn ins Clipboard, dann Rechtsklick auf die TC Buttonbar und wähle "Einfügen".
How to use: mark that code, copy to clipboard, next right click on TCs Button bar and choose 'Paste'.


Anstatt eines Buttons kannst du auch "Benutzer-definierte Kommandos" in der "UserCmd.ini" anlegen und einen Tastaturkürzel zuweisen. Mehr Infos über die "FAQs"-Links am Ende.
Instead of an button you also can create "User-Defined Commands" in "usercmd.ini" and assign an keyboard shortcut. More information via the "FAQs"-Link at the end.



Example output of the "Test button" for the selected files from TC folder:

Code: Select all

D:\rive\TotalCMD\d\
D:\rive\TotalCMD\e\
D:\rive\TotalCMD\LANGUAGE\
D:\rive\TotalCMD\CABRK.DLL
D:\rive\TotalCMD\CGLPT64.SYS
D:\rive\TotalCMD\CGLPT9X.VXD
D:\rive\TotalCMD\CGLPTNT.SYS
D:\rive\TotalCMD\DEFAULT.BAR
D:\rive\TotalCMD\default.br2
D:\rive\TotalCMD\descript.ion
D:\rive\TotalCMD\FRERES32.DLL



Anwendung // Usage

Jetzt verwende eine beliebige Skriptsprache um die temporäre Datei Zeile-für Zeile abzuarbeiten.
Suche im Forum für Beispiele oder bitte andere um Hilfe.
Now use a script language of your choice to process that temp file line by line.
Search the forum for examples or ask others for help.



DOS COMMAND:

Code: Select all

Kommando: cmd /k
Parameter: for /F "delims=" %%Z in ( ' TYPE "%WL" ' ) do @ECHO "%%Z"
Startpfad:
Icondatei: cmd
Tooltip : Test|DOS|For each selected file|Für jede ausgewählte Datei

Code: Select all

TOTALCMD#BAR#DATA
cmd /k
for /F "delims=" %%Z in ( ' TYPE "%WL" ' ) do @ECHO "%%Z"
C:\Windows\system32\cmd.exe
Test|DOS Batch|For each selected file|Für jede ausgewählte Datei

0
-1

Verwende "%l" (kleines L) oder "%WL" / "%WF" um mit Deutschen Umlauten oder anderen speziellen Zeichen / Akzenten zu arbeiten.
Und /Oder versuche "chcp 1252" (Windows) , "chcp 850" (DOS) oder "chcp 65001" (unicode utf-8) als ersten Befehl um die CodePage zu wechseln.
Use "%l" (lower case L) or "%WL" / "%WF" for to work with german umlauts and other chars with special signs / accents.
And /Or try "chcp 1252" (Windows) , "chcp 850" (DOS) or "chcp 65001" (unicode utf-8) as first command to change the CodePage first.



-

Create 30.000 thousand files:
for /L %%i in (1,1,30000) do copy nul %%i.tmp



- - -

DOS BATCH file:

Für größere/kompliziertere Aufgaben erstelle eine "myBatch.cmd" im TC-Ordner und erstelle einen solchen Button.
For bigger/more complicaded tasks create a "myBatch.cmd" in your TC folder and create such a button.

Code: Select all

Kommando: "%COMMANDER_PATH%\myBatch.cmd"
Parameter: "%WF"
Startpfad:
Icondatei: wcmicons.dll
Tooltip : Test|DOS Batch|For each selected file|Für jede ausgewählte Datei

Some "myBatch.cmd" examples:

Code: Select all

@echo off
for %%WL IN (%~1) DO (
    call D:\rive\and\path\to\your\program\here.exe "%%~L"
)

Code: Select all

@echo off
for /F "usebackq delims=" %%I in (%1) do (
   echo Exp:       %%~I
   echo Full Path:   %%~fI
   echo LW:      %%~dI
   echo Path:      %%~pI
   echo File Name:   %%~nI
   echo Extension:   %%~xI
   echo ShortPath:   %%~sI
   echo Attrb:      %%~aI
   echo Date Time:   %%~tI
   echo Size:      %%~zI
   echo ----------------------------
)

https://de.wikibooks.org/wiki/Batch-Programmierung:_Batch-Befehle
https://www.it-zeugs.de/batch-skripte-dos-teil-1.html
https://www.dostips.com/
https://www.tutorialspoint.com/batch_script/batch_script_commands.htm
https://www.robvanderwoude.com/batchcommands.php

- - -

Code: Select all

Kommando: ForFiles /M *.txt /c "cmd /c SetModifiedToCreated1.cmd @file"
Parameter:
Startpfad:
Icondatei: cmd.exe
Tooltip : Test|Call Batch|Set Modified date To Created date
forfiles -p "C:\your path" -s -m *.* -d <number of days> -c "cmd /c del @path"
forfiles /p "C:\your path" /s /m *.* /D -<number of days> /C "cmd /c del @path"
forfiles /p "C:\your path\" /s /m *.* /c "cmd /c RD @path /s /q" /d -30


https://ss64.com/nt/forfiles.html
@file The name of the file.
@fname The file name without extension.
@ext Only the extension of the file.
@path Full path of the file.
@relpath Relative path of the file.
@isdir Returns "TRUE" if a file type is a directory, and "FALSE" for files.
@fsize Size of the file in bytes.
@fdate Last modified date of the file.
@ftime Last modified time of the file.

- - -

PowerShell:

Wie oben bei DOS Batch kann der gesamte Code im Button sein, oder größere/kompliziertere Skripte in einer externen Datei.
Like above with DOS batch the whole code can be inserted into the button or call a external script file for bigger/more complicated scripts.

Code: Select all

Command: PowerShell -NoExit
Parameters: Get-Content '%L' | ForEach-Object{ $_ }
Start path:
Icon file: powershell
Tooltip: Test|PowerShell|For each selected file|Für jede ausgewählte Datei

Code: Select all

TOTALCMD#BAR#DATA
PowerShell -noexit
Get-Content '%WL' | ForEach-Object{ $_ }
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe
Test|PowerShell|Show temporary text file with selected files

0
-1

FROM:
abc.txt
TO:
abc_2020-07-28 172517.txt (add current time stamp)
USE:

Code: Select all

Command: PowerShell
Parameters: Get-Content '%F'|ForEach{$FileName=(GI $_);Rename-Item -Path $FileName -NewName $('{0}_{1}{2}' -f $FileName.BaseName,([datetime]::now).tostring('yyyy-MM-dd HHmmss'),$FileName.Extension)}
Start path:
Icon file: PowerShell
Tooltip: Rename with current timestamp: Base_Time.Ext
{0} ==> $FileName.BaseName
{1} ==> ([datetime]::now).tostring('yyyy-MM-dd HHmmss')
{2} ==> $FileName.Extension

Adjust
tostring( ' yyyy-MM-dd HHmmss ' )
to get wanted time string format, f.ex.:
tostring( ' yyyy-MM-dd_HH-mm ' )
tostring( ' dd.MM.yyyy ' )


FROM:
TOTALCMD.EXE 4.848.656 25.03.2020 08:51 -a--
TO:
2020-03-25 0851_TOTALCMD.EXE   (Add last WriteTime time stamp, also possible CreationTime and LastAccessTime)
USE:

Code: Select all

TOTALCMD#BAR#DATA
PowerShell
Get-Content '%F'|ForEach{$FileName=(GI $_);Rename-Item -Path $FileName -NewName $('{1}_{0}{2}' -f $FileName.BaseName,(($FileName.LastWriteTime).tostring('yyyy-MM-dd HHmm')),$FileName.Extension)} #CreationTime #LastAccessTime
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
Rename with LastWriteTime: Time_Base.Ext

1
-1
Short version:
GC '%F'|%%{$F=(GI $_);RNI $F $('{1}_{0}{2}' -f $F.BaseName,(($F.LastWriteTime).tostring('yyyy-MM-dd HHmm')),$F.Extension)}


-


For each selected file do create an separate checksum file with an external tool like FSUM by SlavaSoft (https://www.slavasoft.com/fsum/)
Output: OrigName.ext _CheckSum.MD5
GC '%WF'|ForEach{&"""$($env:Commander_Path)\Tools\fsum.exe""" '-jnc' $_ > """$_ _CheckSum.MD5"""}
-or-
Output: ___CheckSum_OrigName.ext.MD5
GC '%WF'|ForEach{&"""$($env:Commander_Path)\Tools\fsum.exe""" '-jnc' $_ > ('___CheckSum_'+"""$_"""+'.MD5')}


-

Create an separate checksum file for each sub folder:
Open powershell console in the top/main folder, have the fsum.exe in the top/main folder and execute this PoSh commands.
For the sub folders:
GCI -rec | %{if ($_.PSisContainer){$FLD=$_.FullName ; .\fsum -d"$FLD" *.* > "$FLD\_CheckSum.txt"}}
For the main folder:
GCI | %{ .\fsum *.* > ".\_CheckSum.txt"}

-

Erstelle MD5-Datei mit Dateinamen und vollem Pfad:
#PoSh v4
gi "X:\Y\Z.txt" |ForEach{ $(Get-FileHash $_.FullName -Algorithm MD5) }
#Ausgabe formatiert
gi "X:\Y\Z.txt" |ForEach{ $(Get-FileHash $_.FullName -Algorithm MD5)}|ForEach{"{0} *{1}" -f $_.Hash,$_.Path}

-

Swap names of TWO selected files

$C=Get-Content '%F';if($C.count -eq 2){Rename-Item $C[0] ($C[0]+'.tmp');Rename-Item $C[1] $C[0];Rename-Item ($C[0]+'.tmp') $C[1]}else{'Please select TWO items from one panel'}


-

Create files and folders from text listfile.txt, create FOLDERs if the line from the listfile has trailing backslash (\), else create FILEs :

Code: Select all

Get-Content '.\Your Files list.txt'|
  ForEach{
    $N=$_-replace":","_";
    If($N[-1] -eq '\'){
      MD $N
    }else{
      New-Item -Path . -Name "$N" -ItemType "file" -Value "This is a text string."
    }
}
Or, the other way around:
Create files and folders from text listfile.txt, create FILEs if the line from the listfile
has an dot as fourth (.HTM;.JPG) or fifth (.HTML;.JPEG;myFolder.2020\) sign backwards from the end , else create FOLDERs:

Code: Select all

Get-Content '.\Your Files list.txt'|
  ForEach{
    $N=$_-replace":","_";
    IF($N[-4..-5] -eq '.'){
      New-Item -Path . -Name "$N" -ItemType "file" -Value "This is a text string."
    }else{
      MD $N
    }
}

-

Name einer jpg Datei soll Name an gleiche raf 'vererben'
https://ghisler.ch/board/viewtopic.php?p=384665#p384665

Code: Select all

Get-ChildItem -Filter *.jpg|
  ForEach-Object{
    If ($_.Name.Length -gt 11){
       $B = $_.Name.Substring(0,7); 
       $R = $_.Basename.Substring(7); 
       Rename-Item -Path "$B.RAF" -NewName "$B$R.RAF" -ErrorAction SilentlyContinue
    }
  }
Erklärung:
- Wenn Name länger wie 11 Zeichen (DSCF124.JPG), also zB: "DSCF124 Regenbogen.JPG"
- Speichere die ersten 7 Zeichen des Namen (0-7 ; "DSCF124") in $Base
- Speichere den Rest (7-- ; " Regenbogen") bis zum Ende des Basename (ohne Erweiterung) in $Rest
- Benenne eine eventuell gefundene $B.raf-Datei ("DSCF124" + ".RAF") um in $B$R.RAF ("DSCF124" + " Regenbogen" + ". RAF")
- -ErrorAction SilentlyContinue: wenn keine gleichnamige Datei existiert, mach ohne Fehlermeldung weiter


-

cm_CopyNamesToClip - nachfolgenden Backslash nicht hinzufügen
GC '%WL' | Foreach{ $_ -Replace '\\$' }|clip # Clip.exe hat hier Probleme mit Umlauten
GC '%WL' | Foreach{ $_ -Replace '\\$' }|Set-Clipboard # ab PoSh v5


-

Create files or folders for an test:

1..50 | ForEach-Object{ New-Item -Path $_ -ItemType directory }
Or in short:
1..50|%{MD $_}

Or create 50 folders, formatted to two digits and with Name "Test_":
1..50|%{ MD("Test_{0:D2}" -f $_) }

Or create hundred files, formatted to three digits:
1..100|%{New-Item ("Test_{0:D3}.txt" -f $_) -Itemtype file}

Erstelle 3245 Test-Dateien:
1..3245|%{new-item ("IMG_{0:D4}.jpg" -f $_) -itemtype file}

Kopiere selektierte Datei 10 mal:
for($i=1;$i -lt 11;$i++){copy '%O.%E' $('%O_{0:D4}.%E' -f $i)}

-

Create new directory with current date as name:
New-Item -ItemType Directory -Path """.\$((Get-Date).ToString('yyyy-MM-dd'))"""
or
New-Item -Name ("Auftrag {0:yyyy}-{0:MM}-{0:dd} Kunde" -f (Get-Date)) -ItemType dir

-


Examples of external PoSh scripts:

Command: "%COMMANDER_PATH%\myExternalScript.ps1
Parameters: "%WL"

myExternalScript.ps1:

Code: Select all

$FileList = $args[0]
TYPE $FileList | ForEach{ $_ }
-

Command: Powershell
Parameters: "%WL"
# // The script
# // Check arguments:
If ($Args.Count -eq 0) { "Please use '%L' as TCs parameter. Also select one or more files first. Script quits here."; return}
# //DEBUG:
# Notepad $Args[0]
# //Do the WORK:
TYPE $Args[0] | ForEach{ $_ }





https://www.robvanderwoude.com/powershellstart.php

- - -

Visual Basic Script:

Ein VBS-Skript ist immer eine externe Datei.
Habe eine "myScript.VBS"-Datei im TC-Ordner und erstelle einen solchen Button.
A VBS script is always a external file.
Have a "myScript.VBS"-file in your TC folder and create such a button.

Code: Select all

Command: "%COMMANDER_PATH%\ForEachSelectedDO.vbs"
Parameters: "%WL"
Start path:
Icon file: WScript.exe
Tooltip: Test|ForEachSelectedDO VBS|For each selected file|Für jede ausgewählte Datei

Code: Select all

TOTALCMD#BAR#DATA
"%COMMANDER_PATH%\ForEachSelectedDO.vbs"
"%L"
WScript.exe
Test|ForEachSelectedDO VBS|For each selected file|Für jede ausgewählte Datei


-1

VBS example script:

Code: Select all

"ForEachSelectedDO.vbs"
Set strTCTempFile = CreateObject("Scripting.FileSystemObject").OpenTextFile(WScript.Arguments.Item(0), 1)
Do While Not strTCTempFile.AtEndOfStream
 sOUT = sOUT & strTCTempFile.ReadLine & vbCRLF
Loop
MsgBox WScript.Arguments.Item(0) & vbLF & vbLF & sOUT

Another VBS example:

Code: Select all

Set FSO  = CreateObject("Scripting.FileSystemObject")
Set WSO  = CreateObject("WScript.Shell")
sTCtempList = Wscript.arguments.Item(0) ' The TC temp file due the "%L"
  If  FSO.FileExists(sTCtempList) Then
      WSO.run "notepad " & sTCtempList
      Set oTextStream = FSO.OpenTextFile(sTCtempList,FORREADING)
      Do Until oTextStream.AtEndOfStream
      ...
      Loop
      oTextStream.Close
   Else
      WScript.Echo "Input file  sTCtempList  not found."
   End If



More VBS script example :

Code: Select all

SET FSO	    = WScript.CreateObject("Scripting.FileSystemObject")
SET WSO	    = WScript.CreateObject("WScript.Shell")
SET NET	    = WScript.CreateObject("WScript.Network")
sTCtempList = Wscript.arguments.Item(0) ' The TC temp file due to the "%L" parameter
strTCTarget = Wscript.arguments.Item(1) ' The Target panel due to the "%T" parameter
Const OpenForReading = 1 
'Debug:
If  FSO.FileExists(sTCtempList) Then WSO.run "notepad " & sTCtempList
'Alt 1:
sFileContent = FSO.OpenTextFile(sTCtempList,OpenForReading).ReadAll
'Alt 2:
Set oTextStream = FSO.OpenTextFile(sTCtempList,OpenForReading)
Do Until oTextStream.AtEndOfStream
	sFullName = oTextStream.ReadLine
	If(Right(sFullName,1)= "\") Then 
		Set oItem = FSO.GetFolder(sFirstLine)
	Else
		Set oItem = FSO.GetFile(sFirstLine)
	End If
	sName     = FSO.GetFileName(oItem)
	sBase     = FSO.GetBaseName(oItem)
	sExte     = FSO.GetExtensionName(oItem)
	sSize     = oItem.Size
	sVers     = FSO.GetFileVersion(oItem)
	sCreated  = oItem.DateCreated
	sAccessed = oItem.DateLastAccessed
	sModified = oItem.DateLastModified
	'Attributes: integer value: 0 (Normal), 1 (ReadOnly), 3 (Hidden), 4 (System), 8 (Volume), 
	'16 (Directory), 32 (Archive), 64 (Alias), and 128 (Compressed). ReadOnly(1) + System(4) + Archive(32) = 37
	sAttributes = oItem.Attributes
	'MsgBox sFullName &LF& sName &LF& sBase &LF& sExte
	'//================================================================================
	sDrive  			= FSO.GetDriveName(oItem)
	sPath   			= oItem.ParentFolder
	'//================================================================================
	aPathParts 			= split(sPath, "\")
	iUBound 			= UBound(aPathParts)
	sParentFolder1 		= aPathParts(iUBound)		'//Ex: "Backup"
	If (iUBound > 0) Then sParentFolder2  	=  aPathParts(iUBound -1)
	If (iUBound > 1) Then sParentFolder3  	=  aPathParts(iUBound -2)
	If (iUBound > 0) Then sTopFolder1   	=  aPathParts(1)
	If (iUBound > 1) Then sTopFolder2 		=  aPathParts(2)
	If (iUBound > 2) Then sTopFolder3 		=  aPathParts(3)
	'MsgBox sDrive&LF&sPath&LF&iUBound&LF&sParentFolder1&LF&sParentFolder2&LF&sTopFolder2
	'//================================================================================
	sModified = oItem.DateLastModified	'// 16.05.2018 09:20:00	Deutsch German
	sDate = split(sModified," ")(0)
	sTime = replace(split(sModified," ")(1),":","")
	sDay = split(sDate,".")(0)
	sMon = split(sDate,".")(1)
	sYer = split(sDate,".")(2)
	strTimestamp = sYer &"-"& sMon &"-"& sDay &"-"& sTime 
	'//================================================================================
	'//================================================================================

	'// Do your work here: 
	

Loop
oTextStream.Close
https://www.devguru.com/content/Technologies/VBScript/home.html
https://www.devguru.com/content/Technologies/VBScript/objects-filesystemobject.html
https://www.robvanderwoude.com/wshstart.php




ANother VBS script example :

Code: Select all

REM -----------------------------------------------------
REM Command:   "%Commander_Path%\ForEachSelFileDo - Copy to target and rename.vbs"
REM Parameter: "%L" "%T"  <In Button-Dialog click [Help] button to read more>
REM Start path: <leave empty>
REM Icon: WScript.exe -or- wcmicons.dll
REM Tooltip: Copy to other panel and rename
REM -----------------------------------------------------
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSO = CreateObject("WScript.Shell")
IF (WScript.Arguments.Count>0) Then vTCsTemp=WScript.Arguments(0) ELSE WScript.Quit ' The TC temp file due to the "%L" parameter
IF (WScript.Arguments.Count>1) Then vTCsTarg=WScript.Arguments(1) ELSE MsgBox "Params missing" : WScript.Quit ' The Target panel due to the "%T" parameter
REM -----------------------------------------------------
strNamensZusatz= "_VonCDkopiert_(2019-12-13)"
'//IB = InputBox(prompt[, title][, default] ,Xpos,Ypos,HelpFile location, Context in the help file) 
strNamensZusatz = InputBox(vTCsTarg &vbLF&vbLF& "and add:", "Copy to", strNamensZusatz) 
REM -----------------------------------------------------
SET strTCTempFile = CreateObject("Scripting.FileSystemObject").OpenTextFile(vTCsTemp, 1)
Do While Not strTCTempFile.AtEndOfStream
    strCurrFile = strTCTempFile.ReadLine
    '//process File only, no Folder
    IF Right(strCurrFile,1) <> "\" THEN 
	 strBaseName = FSO.GetBaseName(strCurrFile)
	 strExtensio = FSO.GetExtensionName(strCurrFile)
	 iSerial=iSerial+1
	 strNewName = strBaseName & strNamensZusatz & "_" & iSerial & "." & strExtensio	
	 FSO.CopyFile strCurrFile, vTCsTarg & "\" & strNewName, false
    END IF
LOOP
REM -----------------------------------------------------

- - -

AutoHotkey:

Ein AutoHotkey-Skript ist immer eine externe Datei.
Habe eine "myScript.AHK"-Datei im TC-Ordner und erstelle einen solchen Button.
A AutoHotkey script is always a external file.
Have a "myScript.AHK"-file in your TC folder and create such a button.

Code: Select all

Kommando: "%COMMANDER_PATH%\TOOLs\AHK\autohotkey.exe " "%COMMANDER_PATH%\TOOLs\ForEachFileDo.ahk"
Parameter: "%WL"
Startpfad:
Icondatei: "%COMMANDER_PATH%\TOOLs\AHK\autohotkey.exe"
Tooltip : Test|ForEachFileDo AHK

ForEachFileDo.ahk

Code: Select all

Loop, Read, %1%
    MsgBox %A_LoopReadLine%
-

Another AHK example:

Code: Select all

If (%0% > 0)
{
    vTCtempfile=%1%
    ;MsgBox We are using:`n%vTCtempfile%
    ;Run, notepad %vTCtempfile%
} else {
    MsgBox TC file list parameter "`%WL" is missing, see TC help for more (Search for: Configuration - Change button bar).
    ;ExitApp
}
Loop, Read, %vTCtempfile%
{
    vCurrTempFileLine = %A_LoopReadLine%
    MsgBox Curr line is:`n%vCurrTempFileLine%
}

FAQs: automate/script TC with AutoHotkey AHK
https://ghisler.ch/board/viewtopic.php?p=350976#p350976



FAQs: TC Automatisieren Skripten (Für jede Datei / Alle Dateien)
https://ghisler.ch/board/viewtopic.php?p=344898#p344898

Deustche FAQs >>> https://ghisler.ch/board/viewtopic.php?f=2&t=52423
English FAQs >>>> https://ghisler.ch/board/viewtopic.php?f=3&t=52425
Post Reply