如何停止输出不包含句点的字符串?
How to stop outputting strings that do not contain a period?
我正在拆分剪贴板的内容并一次一个地输出子字符串。只是,我不想输出任何不包含句点的子字符串(我希望忽略不包含句点的字符串)。
Func bulkload()
$origional = ClipGet()
Local $string = ClipGet()
Local $arrayofsubstrings = StringSplit($string, '!')
Local $substringcount = 1
Local $outToClipPut
Do
$outToClipPut = $arrayofsubstrings[$substringcount]
ClipPut($outToClipPut)
Send("{CTRLDOWN}v{CTRLUP}")
Send(@CRLF)
$substringcount = $substringcount + 1
Sleep(300)
Until $substringcount = 100
EndFunc ;==>bulkload
或者从输入中删除所有不包含句点的连续字符串(中间没有空格,也许更好地说,'words')并将此值设置为$string
。任何其他达到相同目的的方法都是可以接受的。我猜我的代码可能看起来像这样:
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
但我得到了这样的错误:
这是我的应用程序:
#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
"bottom line: i want my code to stop outputting strings that do not have a period inside of them."
可能:
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
要从 HotKeySet()
调用的示例(无函数参数):
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
我正在拆分剪贴板的内容并一次一个地输出子字符串。只是,我不想输出任何不包含句点的子字符串(我希望忽略不包含句点的字符串)。
Func bulkload()
$origional = ClipGet()
Local $string = ClipGet()
Local $arrayofsubstrings = StringSplit($string, '!')
Local $substringcount = 1
Local $outToClipPut
Do
$outToClipPut = $arrayofsubstrings[$substringcount]
ClipPut($outToClipPut)
Send("{CTRLDOWN}v{CTRLUP}")
Send(@CRLF)
$substringcount = $substringcount + 1
Sleep(300)
Until $substringcount = 100
EndFunc ;==>bulkload
或者从输入中删除所有不包含句点的连续字符串(中间没有空格,也许更好地说,'words')并将此值设置为$string
。任何其他达到相同目的的方法都是可以接受的。我猜我的代码可能看起来像这样:
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
但我得到了这样的错误:
这是我的应用程序:
#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
"bottom line: i want my code to stop outputting strings that do not have a period inside of them."
可能:
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
要从 HotKeySet()
调用的示例(无函数参数):
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