AutoHotkey: Copy and Paste of Exif via ExifTools: Difference between revisions

From TotalcmdWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
;      I am sorting my photographs. Many of my panoramas do miss any Exif. Thus I have made a simple script
Now I started arranging my photographs: many of panoramas does not have any exif. Thus I have just created a simple tool which makes "copy" and "paste" of exif data among the files.
; Requirements!
I am not very familiar well with both AutoHotKey and [http://www.sno.phy.queensu.ca/~phil/exiftool/ exiftool] thus this script is VERY primitive. But it works. It contains 2 functions: copies EXIF from the file under cursor into temporary file (Alt+Win+C) and pastes EXIF without orientation into the file under cursor (Alt+Win+V). The latter is done by copying the file into temporary folder ('''Correct in script!'''), then in copies EXIF into temporary file ('''must be created beforehand'''). The former - is copying the file into the temporary folder ('''Correct again'''), copies exif data into the file (Original file is retained in the temp folder - just in case. Delete them manually) and copies the filed backwards.
; HotKey must be set in TC  Ctrl + [ = cm_CopyNamesToClip
; HotKey must be set in TC  Ctrl + p = cm_CopyFullNamesToClip
; tempfolder must exist
; tempfile must be created (It is better to use some small real jpg file)


IfWinActive, ahk_class TTOTAL_CMD
It requires several things:
{
#!C::
tempFolder := "G:\temp\"
; That is temporary folder. ExifTools must be here. Folder pash MUST NOT contain spaces and dashed - exiftools will not work
FileName := "ExifTemp.jpg"
; All Tags are copied from the file info FileName temporary file (It must be created beforehand !!!)


; First, file under cursor is sent to temp folser
; Requirements!
Send ^[ ;filename to clipboard TC shortcut
; HotKey must be set in TC:  Ctrl + [ = cm_CopyNamesToClip
File=%tempFolder%%clipboard%
; HotKey must be set in TC:  Ctrl + p = cm_CopyFullNamesToClip
Send ^p ;filename with pathto clipboard TC shortcut
; tempfolder must exist. It should not contain some characters like spaces, etc as ExifTool does not always like it
Destination=%clipboard%
; tempfile must be created beforehand (It is better to use some small real jpg file). It will be overwritten during operation
 
RunWait cmd /C copy /Y %Destination% %tempFolder%
IfWinActive, ahk_class TTOTAL_CMD
 
{
RunWait %tempFolder%exiftool -overwrite_original -TagsFromFile %File% -exif:all %tempFolder%%FileName%
#!C::
; clipboard=%tempFolder%exiftool -overwrite_original -TagsFromFile %File% -exif:all %tempFolder%%FileName%
tempFolder := "G:\temp\"
; That is temporary folder. ExifTools must be here. Folder path MUST NOT contain spaces and dashed - exiftools will not work
Return
FileName := "ExifTemp.jpg"
}
; All Tags are copied from the file info FileName temporary file (It must be created beforehand !!!)
Return
 
; First, file under cursor is sent to temp folser
 
Send ^[ ;filename to clipboard TC shortcut
IfWinActive, ahk_class TTOTAL_CMD
File=%tempFolder%%clipboard%
{
Send ^p ;filename with path to clipboard TC shortcut
#!V::
Destination=%clipboard%
; All Tags are copied from the file info FileName temporary file (It must be created beforehand !!!)
tempFolder := "G:\temp\"
RunWait cmd /C copy /Y %Destination% %tempFolder%
; That is temporary folder. ExifTools must be here. Folder pash MUST NOT contain spaces and dashed - exiftools will not work
FileName := "ExifTemp.jpg"
RunWait %tempFolder%exiftool -overwrite_original -TagsFromFile %File% -exif:all %tempFolder%%FileName%
; All Tags are copied from the file info FileName temporary file (It must be created beforehand !!!)
; clipboard=%tempFolder%exiftool -overwrite_original -TagsFromFile %File% -exif:all %tempFolder%%FileName%
 
 
Return
Send ^[ ;filename to clipboard
}  
File=%clipboard%
Return
Send ^p ;filename with pathto clipboard TC shortcut
Destination=%clipboard%
 
IfWinActive, ahk_class TTOTAL_CMD
RunWait cmd /C copy /Y %Destination% %tempFolder%  
{  
 
#!V::
RunWait %tempFolder%exiftool.exe -TagsFromFile %tempFolder%%FileName% -exif:all -Orientation= %tempFolder%%File%
; All Tags are copied from the file info FileName temporary file (It must be created beforehand !!!)
; clipboard=%tempFolder%exiftool.exe -overwrite_original -TagsFromFile %tempFolder%%FileName% %tempFolder%%File%
tempFolder := "G:\temp\"
; That is temporary folder. ExifTools must be here. Folder path MUST NOT contain spaces and dashed - exiftools will not work
RunWait cmd /C copy /Y %tempFolder%%File% %Destination%
FileName := "ExifTemp.jpg"
 
; All Tags are copied from the file info FileName temporary file (It must be created beforehand !!!)
Return
}
Return
Send ^[ ;filename to clipboard
 
File=%clipboard%
Back to [[AutoHotkey]]
Send ^p ;filename with path to clipboard TC shortcut
[[Category:AutoHotkey scripts|Explorer Directory Tree]]
Destination=%clipboard%
RunWait cmd /C copy /Y %Destination% %tempFolder%  
RunWait %tempFolder%exiftool.exe -TagsFromFile %tempFolder%%FileName% -exif:all -Orientation= %tempFolder%%File%
; clipboard=%tempFolder%exiftool.exe -overwrite_original -TagsFromFile %tempFolder%%FileName% %tempFolder%%File%
RunWait cmd /C copy /Y %tempFolder%%File% %Destination%
Return
}  
Return

Revision as of 17:30, 22 December 2012

Now I started arranging my photographs: many of panoramas does not have any exif. Thus I have just created a simple tool which makes "copy" and "paste" of exif data among the files. I am not very familiar well with both AutoHotKey and exiftool thus this script is VERY primitive. But it works. It contains 2 functions: copies EXIF from the file under cursor into temporary file (Alt+Win+C) and pastes EXIF without orientation into the file under cursor (Alt+Win+V). The latter is done by copying the file into temporary folder (Correct in script!), then in copies EXIF into temporary file (must be created beforehand). The former - is copying the file into the temporary folder (Correct again), copies exif data into the file (Original file is retained in the temp folder - just in case. Delete them manually) and copies the filed backwards.

It requires several things:

;	Requirements!
;	HotKey must be set in TC:  Ctrl + [ = cm_CopyNamesToClip
;	HotKey must be set in TC:  Ctrl + p = cm_CopyFullNamesToClip
;	tempfolder must exist. It should not contain some characters like spaces, etc as ExifTool does not always like it
;	tempfile must be created beforehand (It is better to use some small real jpg file). It will be overwritten during operation

IfWinActive, ahk_class TTOTAL_CMD
{
	#!C::
	tempFolder := "G:\temp\"	
	; That is temporary folder. ExifTools must be here. Folder path MUST NOT contain spaces and dashed - exiftools will not work
	FileName := "ExifTemp.jpg"
	; All Tags are copied from the file info FileName temporary file (It must be created beforehand !!!)

	; First, file under cursor is sent to temp folser
	Send ^[		;filename to clipboard 			TC shortcut
	File=%tempFolder%%clipboard%
	Send ^p		;filename with path to clipboard 	TC shortcut
	Destination=%clipboard%

	RunWait cmd /C copy /Y %Destination% %tempFolder%

	RunWait %tempFolder%exiftool -overwrite_original -TagsFromFile %File% -exif:all %tempFolder%%FileName%
;	clipboard=%tempFolder%exiftool -overwrite_original -TagsFromFile %File% -exif:all %tempFolder%%FileName%
	
	Return
} 
Return


IfWinActive, ahk_class TTOTAL_CMD
{ 
	#!V::
	; All Tags are copied from the file info FileName temporary file (It must be created beforehand !!!)
	tempFolder := "G:\temp\"	
	; That is temporary folder. ExifTools must be here. Folder path MUST NOT contain spaces and dashed - exiftools will not work
	FileName := "ExifTemp.jpg"
	; All Tags are copied from the file info FileName temporary file (It must be created beforehand !!!)


	Send ^[		;filename to clipboard
	File=%clipboard%
	Send ^p		;filename with path to clipboard 	TC shortcut
	Destination=%clipboard%

	RunWait cmd /C copy /Y %Destination% %tempFolder% 

	RunWait %tempFolder%exiftool.exe -TagsFromFile %tempFolder%%FileName% -exif:all -Orientation= %tempFolder%%File%
; 	clipboard=%tempFolder%exiftool.exe -overwrite_original -TagsFromFile %tempFolder%%FileName% %tempFolder%%File%
	
	RunWait cmd /C copy /Y %tempFolder%%File% %Destination%

	Return
} 
Return