本文主要是介绍(AutoIt 实例)图片批量重命名小工具,支持jpg、jpeg、png、gif格式,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
近来无聊写的,用时要先把软件放在图片目录,设置好名字,然后点击立即执行,图片会以 你设置的名字 + 数字 把图片重命名。简单易用。
目前只支持jpg、jpeg、png、gif格式,若想支持更多格式,可以稍加修改。
软件小工具(源代码和执行文件)下载地址:
百度网盘 :链接: http://pan.baidu.com/s/1eQEYuqu 密码: cyvd
【病毒检测结果】
网上测试病毒结果:2/36报毒 已经尽力了 http://r.virscan.org/633f25abc6eb05cb86987f5b8ef6816d
大家可以用各大工具查杀,不放心的莫下载了。
AutoIt V3版本编写,很小众的一个脚本语言,软件官方网站 https://www.autoitscript.com/site/
#cs ----------------------------------------------------------------------------AutoIt Version: 3.3.8.1Author: 西嘎嘎Script Function:图片批量重命名小工具#ce ----------------------------------------------------------------------------; Script Start - Add your code below here#include <File.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)Global $aparts[2] = [180, -1]
Global $data[8] = ["jpg","JPG","jpeg","JPEG","png","PNG","gif","GIF"]#region ### START Koda GUI section ###
$Form1_1 = GUICreate("图片批量重命名", 265, 142, 570, 303)
$MenuItem1 = GUICtrlCreateMenu("帮助")
$shuoming = GUICtrlCreateMenuItem("说明", $MenuItem1)
$about = GUICtrlCreateMenuItem("关于", $MenuItem1)
$input1 = GUICtrlCreateInput("在这里设置图片名字", 24, 16, 217, 21)
$Button1 = GUICtrlCreateButton("立 即 执 行", 24, 56, 219, 25)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
GUISetOnEvent($GUI_EVENT_CLOSE, "main")
GUICtrlSetOnEvent($shuoming, "main")
GUICtrlSetOnEvent($about, "main")
GUISetState(@SW_SHOW)
GUICtrlSetOnEvent($Button1, "main")
#endregion ### END Koda GUI section ###
GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE")
_GUICtrlStatusBar_SetParts($StatusBar1, $aparts)
_GUICtrlStatusBar_SetText($StatusBar1, "Thank you for using", 0)
_GUICtrlStatusBar_SetText($StatusBar1, "Version 0.1", 1)While True_ReduceMemory(@AutoItPID)Sleep(3000)
WEndFunc main()Switch @GUI_CtrlIdCase $GUI_EVENT_CLOSEFileDelete(@ScriptDir & "\*.au3.tmp")ExitCase $Button1zhixing()Case $aboutMsgBox(0 + 8192, "关于", "图片批量修改小工具" & @LF & @LF & "by skywn ")Case $shuomingMsgBox(0 + 8192, "说明", "将小工具放到相应目录" & @LF & @LF & "支持格式 jpg jpeg png gif ")EndSwitch
EndFunc ;==>main
Func zhixing()$picname = GUICtrlRead($input1)If $picname = "在这里设置图片名字" ThenMsgBox(64 + 8192, "Attention", "你还没设图片名字哦 >o<")ElseLocal $FileList = _FileListToArray(@ScriptDir)If @error ThenMsgBox(4096, "", "居然出错了 >o<")ExitEndIf$PicNum = $FileList[0]$PicBitNum = 0While $PicNum >= 1$PicNum /= 10$PicBitNum +=1WEnd$PicNameNum = 1For $tt = 0 To 6 Step 2$PicIndex = 1While $PicIndex + $PicNameNum <= $FileList[0] + 1If StringRegExp($FileList[$PicIndex], "(.*" & $data[$tt] & ")|(.*" & $data[$tt+1] & ")") Then$temp = $PicNameNum$PicBitNameNum = 0While $temp >=1$temp /=10$PicBitNameNum +=1WEnd$PicNameAdd0 = ""For $temp = $PicBitNameNum To $PicBitNum -1$PicNameAdd0 &= "0"Next$check = _ArrayBinarySearch($FileList,$picname & $PicNameAdd0 & $PicNameNum &"."& $data[$tt] ,$PicIndex)If $check > $PicIndex Then_ArrayDelete($FileList, $check)$PicNameNum +=1ElseFileMove(@ScriptDir & "\" & $FileList[$PicIndex], @ScriptDir & "\" & $picname &$PicNameAdd0 & _$PicNameNum & "."& $data[$tt], 1)_ArrayDelete($FileList, $PicIndex)$PicNameNum += 1EndIfElse$PicIndex += 1EndIfWEndNextMsgBox(64 + 8192, "Attention", "已经处理了" & $PicNameNum - 1 & "张图片!")EndIf
EndFunc ;==>zhixingFunc WM_ENTERSIZEMOVE($hWndGUI, $MsgID, $WParam, $LParam)WinSetTrans($Form1_1, "", 130)
EndFunc ;==>WM_ENTERSIZEMOVEFunc WM_EXITSIZEMOVE($hWndGUI, $MsgID, $WParam, $LParam)WinSetTrans($Form1_1, "", 255)
EndFunc ;==>WM_EXITSIZEMOVEFunc _ReduceMemory($i_PID = -1)If $i_PID <> -1 ThenLocal $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])ElseLocal $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)EndIfReturn $ai_Return[0]
EndFunc ;==>_ReduceMemory
这篇关于(AutoIt 实例)图片批量重命名小工具,支持jpg、jpeg、png、gif格式的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!