AutoHotkey - 用Notepad ++打开html文件然后查找并替换,然后保存,关闭。将其包含在另一个脚本中

时间:2016-06-21 20:36:48

标签: notepad++ autohotkey shortcut

1。在文件夹“2”中,我想用Notepad ++打开一个选定的“example.html”文件。或者第二个鼠标按钮 - >用Notepad ++编辑

2. 然后找到单词“big”并将其替换为“small”,保存并退出Notepad ++并返回文件夹“2”。

选择html文件时 - 单个快捷键如何进行2个第一步。 不将其实现到另一个脚本中。

3。如何在拉链并将内容移动到“FINAL”文件夹之前使用此脚本实现上述脚本。因为其中一个文件有html文件,我需要执行上述两个步骤。我想脚本应该在之前启动:“发送^ a;全选”部分。

#IfWinActive ahk_class CabinetWClass

F4::
for window in ComObjCreate("Shell.Application").Windows
try Fullpath := % window.Document.Folder.Self.Path
IfNotExist, %Fullpath%\1\2
{
MsgBox, The folder "%Fullpath%\1\2" doesn't exist
    return
}
Run, %Fullpath%\1\2
WinWait, %Fullpath%\1\2
WinActivate, %Fullpath%\1\2
WinWaitActive,%Fullpath%\1\2
StringReplace, Fullpath2, Fullpath, :,
StringSplit, folder_array, Fullpath2, \,
FolderName = % folder_array%folder_array0%
; MsgBox, % folder_array%folder_array0%
; Sleep 2000      ; wait 2 seconds
Send ^a                 ; Select All
Send, {AppsKey}         ; Press the "context menu" key
Sleep 100
Send n              ; Select "Send to" with the "n" key
Sleep 100
Send {Right}            ; Open "Sent to" with the "right arrow" key
Sleep 100
Send {Down}             ; Select "Compressed (zipped) folder" with the "arrow down" key
Sleep 100
Send {Enter}            ; Execute "Compressed (zipped) folder" with the     "Enter" key
    Sleep 2000      ; wait 2 seconds
    SendInput, % folder_array%folder_array0%
    Send {Enter}
SetTimer, Move_ZIP, 500
return

#IfWinActive

Move_ZIP:
FileCreateDir %A_Desktop%\FINAL
IfExist, %Fullpath%\1\2\%FolderName%.zip
{
SetTimer, Move_ZIP, off
FileMove, %Fullpath%\1\2\%FolderName%.zip, %A_Desktop%\FINAL
Sleep 2000      ; wait 2 seconds
SetTimer, CopyDir, 500
}
return

CopyDir:
IfExist, %Fullpath%\1\2\%FolderName%.zip
return
SetTimer, CopyDir, off
FileCopyDir  %Fullpath%\1\2, %A_Desktop%\FINAL\%FolderName%
return

1 个答案:

答案 0 :(得分:0)

string = 'abcd'
inn = ''
out = ''
letters = 'az'

# Rubify below, por favor
letters.split('').each do |l|
  if string[/#{l}/i]
    inn << l
  else
    out << l
  end
end

https://autohotkey.com/docs/commands/FileRead.htm

https://autohotkey.com/docs/commands/StringReplace.htm

https://autohotkey.com/docs/commands/FileAppend.htm