String 如何停止输出不包含句点的字符串?
我正在分割剪贴板的内容,并一次输出一个子字符串。只是,我不想输出任何不包含句点的子字符串(我希望忽略不包含句点的字符串) < P>替换所有连续字符串(中间没有空格,最好说“单词”),它不包含从输入中输入的句段,并将该值设置为<代码> $Stry。任何其他达到相同目的的方法都是可以接受的。我猜我的代码可能是这样的:String 如何停止输出不包含句点的字符串?,string,autoit,String,Autoit,我正在分割剪贴板的内容,并一次输出一个子字符串。只是,我不想输出任何不包含句点的子字符串(我希望忽略不包含句点的字符串) < P>替换所有连续字符串(中间没有空格,最好说“单词”),它不包含从输入中输入的句段,并将该值设置为 $Stry。任何其他达到相同目的的方法都是可以接受的。我猜我的代码可能是这样的: Func bulkload() $origional = ClipGet() Local $string = ClipGet() Local $arrayofsubst
Func bulkload()
$origional = ClipGet()
Local $string = ClipGet()
Local $arrayofsubstrings = StringSplit($string, '!')
Local $substringcount = 1
Local $outToClipPut
Do
$outToClipPut = $arrayofsubstrings[$substringcount]
;check for a period
If $ouToClip = "has a period" Then
ClipPut($outToClipPut)
Send("{CTRLDOWN}v{CTRLUP}")
Send(@CRLF)
$substringcount = $substringcount + 1
Sleep(300)
Else
$substringcount = $substringcount + 1
Sleep(300)
EndIf
Until $substringcount = 100
EndFunc ;==>bulkload
这不起作用:
Func bulkload()
$origional = ClipGet()
Local $string = ClipGet()
Local $arrayofsubstrings = StringSplit($string, '!')
Local $substringcount = 1
Local $outToClipPut
Local $searchstring = "."
Do
$outToClipPut = $arrayofsubstrings[$substringcount]
If StringInStr($outToClipPut, $searchstring) Then
ClipPut($outToClipPut)
Send("{CTRLDOWN}v{CTRLUP}")
Send(@CRLF)
$substringcount = $substringcount + 1
Sleep(300)
Else
$substringcount = $substringcount + 1
Sleep(300)
EndIf
Until $substringcount = 100
EndFunc ;==>bulkload
我尝试将“我的代码”替换为:
Func BulkLoad(Const $sDelim = '!', Const $sSearch = '.', Const $iDelay = 250)
Local Const $sInput = ClipGet()
Local Const $aArray = StringSplit($sInput, $sDelim)
For $i1 = 1 To $aArray[0]
If Not StringInStr($aArray[$i1], $sSearch) Then ContinueLoop
ClipPut($aArray[$i1])
Send('^v')
Sleep($iDelay)
Send('{ENTER}')
Sleep($iDelay)
Next
EndFunc
但我得到了这样的错误:
Func bulkload()
$origional = ClipGet()
Local $string = ClipGet()
Local $arrayofsubstrings = StringSplit($string, '!')
Local $substringcount = 1
Local $outToClipPut
Do
$outToClipPut = $arrayofsubstrings[$substringcount]
;check for a period
If $ouToClip = "has a period" Then
ClipPut($outToClipPut)
Send("{CTRLDOWN}v{CTRLUP}")
Send(@CRLF)
$substringcount = $substringcount + 1
Sleep(300)
Else
$substringcount = $substringcount + 1
Sleep(300)
EndIf
Until $substringcount = 100
EndFunc ;==>bulkload
我的这是我的应用程序:
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
#include <StringConstants.au3>
#include <GUIConstants.au3>
#include <GuiDateTimePicker.au3>
#include <Date.au3>
#include <Array.au3>
;lets make an expiration date
$endDate = "2020/02/01"
Local $datediff = _DateDiff('D', $endDate, _NowCalc())
If $datediff > 0 Then
MsgBox(0, "Expired", "Sorry, this program has expired, contact admin@elishahabinsky.com for an extension.", 15)
Exit
EndIf
MsgBox($MB_SYSTEMMODAL, "", "Copy a complete URL to clipboard or press Ctrl+Shift+a." & @CRLF & "Press Ctrl+Shift+d to insert multiple URLs." & @CRLF & "Page:" & @CRLF & " removes the begginning of the URL string until the domain name." & @CRLF & "Site:" & @CRLF & "select the entire domain leaving out the page specification." & @CRLF & "Ignore:" & @CRLF & "Ignore this URL." & @CRLF & "IP:" & @CRLF & "Place the IP of the domain into the clipboard." & @CRLF & "Exit:" & @CRLF & "Terminate the program." & @CRLF & "Escape Key:" & @CRLF & "Terminate the program.")
; Press Esc to terminate script, Pause/Break to "pause"
Global $g_bPaused = False
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("^+d", "BulkLoad") ; ctrl-shift-d
HotKeySet("^+a", "TrimItDown")
Func TogglePause()
$g_bPaused = Not $g_bPaused
While $g_bPaused
Sleep(100)
ToolTip('Script is "Paused"', 0, 0)
WEnd
ToolTip("")
EndFunc ;==>TogglePause
Func Terminate()
Exit
EndFunc ;==>Terminate
;new funtion template
Func abc()
;replace this with code
EndFunc ;==>abc
;some functions we will need:
Func altf4()
Sleep(1000)
Send("{ALTDOWN}{F4}{ALTUP}")
Sleep(1000)
EndFunc ;==>altf4
;save ctrl + shift + s
Func ctrlshfts()
Sleep(1000)
Send("{CTRLDOWN}{SHIFTDOWN}s{SHIFTUP}{CTRLUP}")
Sleep(1000)
EndFunc ;==>ctrlshfts
;desktop win + d
Func wind()
Sleep(1000)
Send("{LWINDOWN}d{LWINUP}")
Sleep(1000)
EndFunc ;==>wind
;run win + r
Func winr()
Sleep(1000)
Send("{LWINDOWN}r{LWINUP}")
Sleep(1000)
EndFunc ;==>winr
;paste control + v
Func ctrlv()
Sleep(1000)
Send("{CTRLDOWN}v{CTRLUP}")
Sleep(1000)
EndFunc ;==>ctrlv
;copy control + c
Func ctrlc()
Sleep(1000)
Send("{CTRLDOWN}c{CTRLUP}")
Sleep(1000)
EndFunc ;==>ctrlc
;select all control + a
Func ctrla()
Sleep(1000)
Send("{CTRLDOWN}a{CTRLUP}")
Sleep(1000)
EndFunc ;==>ctrla
Local $folderpath = "%USERPROFILE%\Desktop\tt"
Local $inpath = "%USERPROFILE%\Desktop\tt\i.txt"
Local $outpath = "%USERPROFILE%\Desktop\tt\o.txt"
Func cliptoinpath()
Send("{LWINDOWN}r{LWINUP}")
Sleep(1000)
Send("notepad" & @CRLF)
;ctrlv()
Sleep(1000)
Send("{CTRLDOWN}v{CTRLUP}")
Sleep(1000)
; ctrlshfts()
Send("{CTRLDOWN}{SHIFTDOWN}s{SHIFTUP}{CTRLUP}")
Sleep(1000)
Send($inpath)
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
;altf4()
Send("{ALTDOWN}{F4}{ALTUP}")
Sleep(1000)
EndFunc ;==>cliptoinpath
Local $removelines = "powershell -join ""\""$(Get-Content " & $inpath & ")""\""""" & "{>}" & $outpath & @CRLF
Local $outtoclip
Func removelines()
Sleep(1000)
;do not winwait
Send("{LWINDOWN}r{LWINUP}")
Sleep(1000)
Send("cmd" & @CRLF)
Sleep(1000)
Send($removelines & @CRLF)
Sleep(1000)
EndFunc ;==>removelines
Func removenewlinesfromclip()
$CMD = "echo y | del " & $folderpath & "" & @CRLF
RunWait(@ComSpec & " /V:ON /c " & $CMD)
$CMD = "mkdir " & $folderpath & " " & @CRLF
RunWait(@ComSpec & " /V:ON /c " & $CMD)
cliptoinpath()
$CMD = "ipconfig > " & $outpath & ""
RunWait(@ComSpec & " /V:ON /c " & $CMD)
removelines()
$outtoclip = "type " & $outpath & " |clip"
RunWait(@ComSpec & " /V:ON /c " & $outtoclip)
EndFunc ;==>removenewlinesfromclip
;
While 1
Local $pdf = "PDF"
Local $pingclip
Local $origional
Local $firstThreeInClip = StringMid(ClipGet(), 1, 3)
Local $firstFourInClip = StringMid(ClipGet(), 1, 4)
Local $http = "http"
If $firstFourInClip = $http And $origional <> ClipGet() Then
TrimItDown()
ElseIf $firstThreeInClip = $pdf And $origional <> StringMid(ClipGet(), 1, 3) Then
$origional = StringMid(ClipGet(), 1, 3)
;set paths
Local $folderpath = "%USERPROFILE%\Desktop\tt"
Local $inpath = "%USERPROFILE%\Desktop\tt\i.txt"
Local $outpath = "%USERPROFILE%\Desktop\tt\o.txt"
;save clipboard to a .txt
;remove lines
;use this code in cmd when removing lines
;powershell -command "\"$(Get-Content file.txt)\" > newFile.txt"
Local $removelines = "powershell -join ""\""$(Get-Content " & $inpath & ")""\""""" & "{>}" & $outpath & @CRLF
Local $outtoclip
removenewlinesfromclip()
Local $sString = StringReplace(ClipGet(), " ", "!")
ClipPut($sString)
MsgBox($MB_SYSTEMMODAL, "", ClipGet() & @CRLF & "in clipboard")
Else
Sleep(200)
EndIf
WEnd
;url to page func
Func urltopage()
$sData1 = ClipGet()
$sString1 = StringReplace($sData1, "https://www.", Null)
ClipPut($sString1)
$sData1 = ClipGet()
$sData2 = ClipGet()
$sString2 = StringReplace($sData2, "https://", Null)
ClipPut($sString2)
$sData2 = ClipGet()
$sData3 = ClipGet()
$sString3 = StringReplace($sData3, "http://www.", Null)
ClipPut($sString3)
$sData3 = ClipGet()
$sData4 = ClipGet()
$sString4 = StringReplace($sData4, "http://", Null)
ClipPut($sString4)
$sData4 = ClipGet()
EndFunc ;==>urltopage
;url to site func
Func urltosite()
$sData1 = ClipGet()
$sString1 = StringReplace($sData1, "https://www.", Null)
ClipPut($sString1)
$sData1 = ClipGet()
$sData2 = ClipGet()
$sString2 = StringReplace($sData2, "https://", Null)
ClipPut($sString2)
$sData2 = ClipGet()
$sData3 = ClipGet()
$sString3 = StringReplace($sData3, "http://www.", Null)
ClipPut($sString3)
$sData3 = ClipGet()
$sData4 = ClipGet()
$sString4 = StringReplace($sData4, "http://", Null)
ClipPut($sString4)
$sData4 = ClipGet()
$url = ClipGet()
$spliturl = StringSplit($url, '/')
$site = $spliturl[1]
ClipPut($site)
EndFunc ;==>urltosite
;url to ip func
Func urltoip()
;trim to site
$sData1 = ClipGet()
$sString1 = StringReplace($sData1, "https://www.", Null)
ClipPut($sString1)
$sData1 = ClipGet()
$sData2 = ClipGet()
$sString2 = StringReplace($sData2, "https://", Null)
ClipPut($sString2)
$sData2 = ClipGet()
$sData3 = ClipGet()
$sString3 = StringReplace($sData3, "http://www.", Null)
ClipPut($sString3)
$sData3 = ClipGet()
$sData4 = ClipGet()
$sString4 = StringReplace($sData4, "http://", Null)
ClipPut($sString4)
$sData4 = ClipGet()
$url = ClipGet()
$spliturl = StringSplit($url, '/')
$site = $spliturl[1]
ClipPut($site)
;use this for realtime testing
;https://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm
$CMD = "ping " & ClipGet() & " | clip"
RunWait(@ComSpec & " /c " & $CMD)
;save ping clip to $pingclip
$pingclip = ClipGet()
;split string pinglip to second substring with '[' as paraneter
$pingclip = StringSplit($pingclip, '[')
$pingclip = $pingclip[2]
;split string pinglip to first substring with ']' as paraneter
$pingclip = StringSplit($pingclip, ']')
$pingclip = $pingclip[1]
ClipPut($pingclip)
EndFunc ;==>urltoip
Func BulkLoad(Const $sDelim = '!', Const $sSearch = '.', Const $iDelay = 250)
Local Const $sInput = ClipGet()
Local Const $aArray = StringSplit($sInput, $sDelim)
For $i1 = 1 To $aArray[0]
If Not StringInStr($aArray[$i1], $sSearch) Then ContinueLoop
ClipPut($aArray[$i1])
Send('^v')
Sleep($iDelay)
Send('{ENTER}')
Sleep($iDelay)
Next
EndFunc
;bulkload tutorial func
Func loaderTutorial()
;Run("C:\Program Files (x86)\Notepad++\notepad++.exe " & $CmdLine[0])
MsgBox($MB_SYSTEMMODAL, "", "Position the cursor where load sequence will begin")
MsgBox($MB_SYSTEMMODAL, "", "Press Ctrl + Shift + d to deploy.")
MsgBox($MB_SYSTEMMODAL, "", "This hotkey is always active")
EndFunc ;==>loaderTutorial
Func TrimItDown()
GUICreate("StringTools", 460, 145)
GUICtrlCreateLabel("Please select", 1, 1)
Local $idButton_Page = GUICtrlCreateButton("Page", 10, 25, 140, 50)
Local $idButton_Site = GUICtrlCreateButton("Site", 160, 25, 140, 50)
Local $idButton_Origional = GUICtrlCreateButton("Ignore", 310, 25, 140, 50)
Local $idButton_ip = GUICtrlCreateButton("IP", 10, 90, 140, 50)
;Local $idButton_BulkLoad = GUICtrlCreateButton("Bulk Load", 95, 90, 100, 50)
Local $idButton_bulkloadTutorial = GUICtrlCreateButton("Bulk Load Tutorial", 160, 90, 140, 50)
Local $idButton_Exit = GUICtrlCreateButton("Exit", 310, 90, 140, 50)
;Local $aAccelKeys[5][5] = [["^!+y", $idButton_Page], ["^!+n", $idButton_Site], ["^!+t", $idButton_Origional], ["^!+u", $idButton_ip], ["^!+u", $idButton_Exit]]
;GUISetAccelerators($aAccelKeys)
GUISetState(@SW_SHOW) ; Display the GUI.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Send("{Esc}")
GUIDelete()
ExitLoop
Case $idButton_Page
urltopage()
ExitLoop
Case $idButton_Site
urltosite()
ExitLoop
Case $idButton_Origional
$origional = ClipGet()
ExitLoop
Case $idButton_ip
urltoip()
ExitLoop
Case $idButton_bulkloadTutorial
loaderTutorial()
ExitLoop
Case $idButton_Exit
Send("{Esc}")
ExitLoop
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>TrimItDown
;test string
#cs
PDF
wikkipedia.ord
snapfish.com
.tunnelbear.com
mail.google.com/mail/u/0/#inbox
google.com/url?q=https://connect.cloudberrylab.com?i%3D448781782&source=gmail&ust=1573146628917000&usg=AFQjCNF14Y-dux0_bNSOc-jOfjLgHy-3fw
#ce
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
;让我们定一个截止日期
$endDate=“2020/02/01”
本地$datediff=\u datediff('D',$endDate,\u NowCalc())
如果$datediff>0,则
MsgBox(0,“过期”,“抱歉,此程序已过期,请联系admin@elishahabinsky.com,第15段)
出口
恩迪夫
MsgBox($MB_SYSTEMMODAL,“,”将完整的URL复制到剪贴板,或按Ctrl+Shift+a.“&@CRLF&”按Ctrl+Shift+d插入多个URL.&@CRLF&“页面:&@CRLF&”删除URL字符串的开头,直到域名出现。&@CRLF&“站点:&@CRLF&”选择整个域,而忽略页面规范。&@CRLF&“忽略”::&@CRLF&“忽略此URL。”&@CRLF&“IP:&@CRLF&”将域的IP放入剪贴板。”&@CRLF&“退出:&@CRLF&”终止程序。”&@CRLF&“退出键:&@CRLF&”终止程序。”)
; 按Esc键终止脚本,暂停/中断至“暂停”
全局$g_bPaused=False
热键集(“{PAUSE}”,“TogglePause”)
热键集(“{ESC}”,“终止”)
热键集(“^+d”,“批量加载”);ctrl-shift-d
热键集(“^+a”、“TrimItDown”)
函数切换暂停()
$g_bPaused=非$g_bPaused
而$g_b是
睡眠(100)
工具提示('脚本已“暂停”,0,0)
温德
工具提示(“”)
EndFunc;==>切换暂停
Func终止()
出口
EndFunc;==>终止
;新功能模板
Func abc()
;将此替换为代码
EndFunc;==>abc
;我们需要的一些功能:
函数altf4()
睡眠(1000)
发送(“{ALTDOWN}{F4}{ALTUP}”)
睡眠(1000)
EndFunc;==>altf4
;保存ctrl+shift+s
函数ctrlshfts()
睡眠(1000)
发送(“{CTRLDOWN}{SHIFTDOWN}s{SHIFTUP}{CTRLUP}”)
睡眠(1000)
EndFunc;==>ctrlshfts
;桌面win+d
Func wind()
睡眠(1000)
发送(“{LWINDOWN}d{LWINUP}”)
睡眠(1000)
EndFunc;==>风
;运行win+r
Func winr()
睡眠(1000)
发送(“{LWINDOWN}r{LWINUP}”)
睡眠(1000)
EndFunc;==>温纳
;粘贴控制+v
函数ctrlv()
睡眠(1000)
发送(“{CTRLDOWN}v{CTRLUP}”)
睡眠(1000)
EndFunc;==>ctrlv
;复制控制+c
函数中心()
睡眠(1000)
发送(“{CTRLDOWN}c{CTRLUP}”)
睡眠(1000)
EndFunc;==>ctrlc
;选择所有控件+a
函数中心()
睡眠(1000)
发送({CTRLDOWN}a{CTRLUP})
睡眠(1000)
EndFunc;==>特拉
本地$folderpath=“%USERPROFILE%\Desktop\tt”
本地$inpath=“%USERPROFILE%\Desktop\tt\i.txt”
本地$outpath=“%USERPROFILE%\Desktop\tt\o.txt”
Func cliptoinpath()
发送(“{LWINDOWN}r{LWINUP}”)
睡眠(1000)
发送(“记事本”和@CRLF)
;ctrlv()
睡眠(1000)
发送(“{CTRLDOWN}v{CTRLUP}”)
睡眠(1000)
; ctrlshfts()
发送(“{CTRLDOWN}{SHIFTDOWN}s{SHIFTUP}{CTRLUP}”)
睡眠(1000)
发送($inpath)
睡眠(1000)
发送(“{ENTER}”)
睡眠(1000)
;altf4()
发送(“{ALTDOWN}{F4}{ALTUP}”)
睡眠(1000)
EndFunc;==>cliptoinpath
本地$removelines=“powershell-join”“\”“$(获取内容“&$inpath&”“\”&“{>}”&$outpath&@CRLF
本地$outtoclip
Func removelines()
睡眠(1000)
;不要等待
发送(“{LWINDOWN}r{LWINUP}”)
睡眠(1000)
发送(“cmd”和@CRLF)
睡眠(1000)
发送($removelines和@CRLF)
睡眠(1000)
EndFunc;==>拆除
Func removenewlinesfromclip()函数
$CMD=“echo y|del”和$folderpath&=“echo y|del”和@CRLF
RunWait(@ComSpec&“/V:ON/c”&$CMD)
$CMD=“mkdir”和$folderpath&“”&@CRLF
RunWait(@ComSpec&“/V:ON/c”&$CMD)
cliptoinpath()
$CMD=“ipconfig>”&$outpath&“
RunWait(@ComSpec&“/V:ON/c”&$CMD)
removelines()
$outtoclip=“type”和$outpath&“| clip”
RunWait(@ComSpec&“/V:ON/c”和$outtoclip)
EndFunc;==>从夹子上拆下线
;
而1
本地$pdf=“pdf”
本地$pingclip
本地$original
本地$firstThreeInClip=StringMid(ClipGet(),1,3)
本地$firstFourInClip=StringMid(ClipGet(),1,4)
本地$http=“http”
如果$firstFourInClip=$http和$origional ClipGet(),则
TrimItDown()
ElseIf$firstThreeInClip=$pdf和$origionalstringmid(ClipGet(),1,3),然后
$origional=StringMid(ClipGet(),1,3)
;设置路径
本地$folderpath=“%USERPROFILE%\Desktop\tt”
本地$inpath=“%USERPROFILE%\Desktop\tt\i.txt”
本地$outpath=“%USERPROFILE%\Desktop\tt\o.txt”
;将剪贴板保存到.txt文件
;拆线
;删除行时在cmd中使用此代码
;powershell-命令“\”$(获取内容文件.txt)\”>newFile.txt
本地$removelines=“powershell-join”“\”“$(获取内容“&$inpath&”“\”&“{>}”&$outpath&@CRLF
本地$outtoclip
从Clip()中删除线
本地$sString=StringReplace(ClipGet(),“”,“!”)
ClipPut($sString)
MsgBox($MB_SYSTEMMODAL,“,ClipGet()&@CRLF&“在剪贴板中”)
其他的
睡眠(200)
恩迪夫
温德
;指向页面func的url
Func urltopage()
$sData1=ClipGet()
$sString1=StringReplace($sData1,”https://www.“,空)
ClipPut($sString1)
$sData1=ClipGet()
$sData2=ClipGet()
$sString2=StringReplace($sData2,“https://”,Null)
ClipPut($sString2)
$sData2=ClipGet()
$sData3=ClipGet()
$sString3=StringReplace($sData3,”http://www.“,空)
ClipPut($sString3)
If Not StringInStr($aArray[$i1], $sSearch) Then ContinueLoop
Func BulkLoad(Const $sDelim = '!', Const $sSearch = '.', Const $iDelay = 250)
Local Const $sInput = ClipGet()
Local Const $aArray = StringSplit($sInput, $sDelim)
For $i1 = 1 To $aArray[0]
If Not StringInStr($aArray[$i1], $sSearch) Then ContinueLoop
ClipPut($aArray[$i1])
Send('^v')
Sleep($iDelay)
Send('{ENTER}')
Sleep($iDelay)
Next
EndFunc
Func BulkLoad()
Local Const $iDelay = 250
Local Const $sDelim = '!', _
$sSearch = '.', _
$sInput = ClipGet()
Local Const $aArray = StringSplit($sInput, $sDelim)
For $i1 = 1 To $aArray[0]
If Not StringInStr($aArray[$i1], $sSearch) Then ContinueLoop
ClipPut($aArray[$i1])
Send('^v')
Sleep($iDelay)
Send('{ENTER}')
Sleep($iDelay)
Next
EndFunc