找回密码
 加入
搜索
查看: 1813|回复: 6

求助

[复制链接]
发表于 2009-6-16 20:55:12 | 显示全部楼层 |阅读模式
下面的代码那个朋友帮助该一下现在的还的手动去找路径,该成默认读取一个TXT可以自己设置任何名字。
还有释放那个URL只要百度就行,最后就是运行程序以后都是自动的直接就可以在后台运行了意思就是看不到现在的界面

#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_outfile=搜索引擎工具.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Winapi.au3>
#include <IE.au3>
#Include <File.au3>
HotKeySet("{f3}","ieshow1")
HotKeySet("{f4}","winshow1")
while 1
$sFilePath = FileOpenDialog( "请选择随即关键词txt文件", @ScriptDir, "(*.txt)", 3)
If @error Then
    MsgBox(0,"","你没有选择任何文件,程序将退出。")
        Exit
EndIf
ExitLoop
WEnd
$uur=""
$hanghao = _FileCountLines($sFilePath)
$oIE = _IECreate ("about:blank",1,0,0,-1);打开网页,可以隐藏IE
_IEPropertySet ($oIE, "toolbar", 0) ;隐藏toolbar
_IEPropertySet ($oIE, "width", 400) ;设置ie宽800像素
_IEPropertySet ($oIE, "height", 400) ;设置ie高600像素
_IEPropertySet ($oIE, "resizable", 0) ;设置ie不可以调整大小
$suiji = 0
$xunhuan = 0
$chaoshi = 0
$dangqian = 0
$tongji = 0
$line = "请输入关键词"
opt("guiOneventMode",1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("程序配置", 257, 195, 192, 150)
GUISetOnEvent($gui_event_close,"Close_Click",$Form1)
$Label0 = GUICtrlCreateLabel("URL:", 8, 10, 28, 17)
$Combo1 = GUICtrlCreateCombo("", 38, 8, 211, 25)
gengxin($uur)
$Group1 = GUICtrlCreateGroup("配置", 8, 33, 241, 137)
$Button1 = GUICtrlCreateButton("开始", 144, 49, 97, 89, $WS_GROUP)
GUICtrlSetOnEvent(-1,"RUNSTART")
$Label1 = GUICtrlCreateLabel("当前:"&$dangqian&"\统计:"&$tongji&"\词库:"&$hanghao, 8, 177, 200, 17)
GUICtrlSetColor(-1, 0x716F64)
$Checkbox1 = GUICtrlCreateCheckbox("显示IE窗口[F3]", 16, 49, 100, 17)
GUICtrlSetOnEvent(-1,"ieshow")
$Checkbox2 = GUICtrlCreateCheckbox("随机使用词库", 16, 97, 89, 17)
GUICtrlSetOnEvent(-1,"suiji")
$Checkbox3 = GUICtrlCreateCheckbox("循环使用词库", 16, 121, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("设置页面超时", 16, 145, 94, 17)
GUICtrlSetOnEvent(-1,"chaoshi")
$Input1 = GUICtrlCreateInput("1000", 112, 145, 49, 21)
GUICtrlSetState ($Input1,$GUI_DISABLE)
$Label2 = GUICtrlCreateLabel("毫秒", 168, 148, 28, 17)
$Checkbox5 = GUICtrlCreateCheckbox("隐藏当前窗体[F4]", 16, 73, 113, 17)
GUICtrlSetOnEvent(-1,"winshow")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Func gengxin(ByRef $uur)
        $URLL=IniReadSection("URL.INI","URL")
If @error Then
    $sData = "1=http://www.sogou.com/sogou?query=" & @LF & "2=http://www.baidu.com/s?wd=" & @LF & "3=http://www.google.cn/search?hl=zh-CN&q="& @LF & "4=http://www.gougou.com/search?search="
IniWriteSection("URL.INI","URL", $sData)
Else
        if $URLL[0][0] >1 Then
    For $i = 1 To $URLL[0][0]-1
$uur=$uur&$URLL[$i][1]&"|"
    Next
$uur=$uur&$URLL[$URLL[0][0]][1]
Else
        $uur=$uur&$URLL[$URLL[0][0]][1]
EndIf
EndIf
        GUICtrlSetData ($Combo1,$uur,$URLL[1][1])
EndFunc


Func RUNSTART()
if         GUICtrlRead ($Button1) = "开始" then
GUICtrlSetData ($Button1,"暂停")
Else
GUICtrlSetData ($Button1,"开始")
EndIf
EndFunc
Func Close_Click()
        _IEQuit ($oIE)
        Exit
EndFunc
Func ieshow1()
if BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED) Then
GUICtrlSetState ( $Checkbox1, $GUI_UNCHECKED )
Else
GUICtrlSetState ( $Checkbox1, $GUI_CHECKED )
EndIf
ieshow()
EndFunc
Func winshow1()
if BitAnd(GUICtrlRead($Checkbox5),$GUI_CHECKED) Then
GUICtrlSetState ( $Checkbox5, $GUI_UNCHECKED )
Else
GUICtrlSetState ( $Checkbox5, $GUI_CHECKED )
EndIf
winshow()
EndFunc
Func ieshow()
if BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED) Then
        _IEAction ($oIE,"visible")       
Else
        _IEAction ($oIE,"invisible")
EndIf
EndFunc
Func winshow()
if BitAnd(GUICtrlRead($Checkbox5),$GUI_CHECKED) Then
        GUISetState(@SW_HIDE,$Form1)
Else
        GUISetState(@SW_SHOW,$Form1)
EndIf
EndFunc

Func bianliang(ByRef $suiji,ByRef $xunhuan,ByRef $chaoshi)
if BitAnd(GUICtrlRead($Checkbox2),$GUI_CHECKED)Then
$suiji = 1               
$xunhuan = 1
Else
$suiji = 0
EndIf
if BitAnd(GUICtrlRead($Checkbox3),$GUI_CHECKED)Then
$xunhuan = 1
Else
$xunhuan = 0
EndIf
if BitAnd(GUICtrlRead($Checkbox4),$GUI_CHECKED)Then
$chaoshi = 1               
Else
$chaoshi = 0
EndIf
EndFunc


Func suiji()
if BitAnd(GUICtrlRead($Checkbox2),$GUI_CHECKED)Then
GUICtrlSetState ( $Checkbox3, $GUI_CHECKED )
GUICtrlSetState ( $Checkbox3,$GUI_DISABLE)
Else
GUICtrlSetState ( $Checkbox3,$GUI_ENABLE)
EndIf
EndFunc
Func chaoshi()
if BitAnd(GUICtrlRead($Checkbox4),$GUI_CHECKED)Then
GUICtrlSetState ( $Input1,$GUI_ENABLE)
Else
GUICtrlSetState ( $Input1,$GUI_DISABLE)
EndIf
EndFunc


While 1
bianliang($suiji,$xunhuan,$chaoshi)
if         GUICtrlRead ($Button1) = "开始" then
Sleep(0)
Else
guanjian($suiji,$hanghao,$dangqian,$xunhuan,$sFilePath,$line)
if         GUICtrlRead ($Button1) = "暂停" then
_IENavigate ($oIE, GUICtrlRead($Combo1)&$line, 1 )
$tongji = $tongji+1
EndIf
GUICtrlSetData ($Label1,"当前:"&$dangqian&"\统计:"&$tongji&"\词库:"&$hanghao)
yanshi()
EndIf
WEnd

Func yanshi()
        if $chaoshi = 1 Then
sleep(GUICtrlRead($Input1))               
Else
        _IELoadWait        ($oIE)
EndIf
EndFunc



Func guanjian($suiji,$hanghao,ByRef $dangqian,$xunhuan,$sFilePath,ByRef $line)
if $suiji = 1 Then
        $dangqian = Random (1, $hanghao, 1)
Else
        if $dangqian < $hanghao then
                $dangqian = $dangqian +1
        Else
                if $xunhuan = 1 Then
                $dangqian = 1       
                Else
                wancheng($hanghao)
                $dangqian = 0
                EndIf       
        EndIf
EndIf
$file = FileOpen($sFilePath, 0)
$line = FileReadLine($file,$dangqian)
FileClose($file)
EndFunc
Func wancheng($hanghao)
MsgBox(4096,"任务完成","关键词库共有"&$hanghao&"词条,现已读取到最后一个。")
GUICtrlSetData ($Button1,"开始")
EndFunc
发表于 2009-6-16 22:29:49 | 显示全部楼层
本帖最后由 lynfr8 于 2009-6-16 23:27 编辑

$sFilePath = FileOpenDialog( "请选择随即关键词txt文件", @ScriptDir, "(*.txt)", 3)
改为
$sFilePath = @ScriptDir&'\任意文件名.txt'

$sData = "1=http://www.sogou.com/sogou?query=" & @LF & "2=http://www.baidu.com/s?wd=" & @LF & "3=http://www.google.cn/search?hl=zh-CN&q="& @LF & "4=http://www.gougou.com/search?search="
改为:
$sData = "1=http://www.baidu.com/s?wd="   

其他不变,未经严格测试,仅供参考
 楼主| 发表于 2009-6-16 23:11:50 | 显示全部楼层
$sFilePath = @ScriptDir&'\任意文件名.txt'
谢谢这个已经正常使用。
还能在帮我解决一下吗,就是直接运行这个脚本然后看不到托盘图标,然后也不用点击开始才工作
让程序都成自动的运行脚本以后全部都在后台自动工作
发表于 2009-6-16 23:29:11 | 显示全部楼层
本帖最后由 lynfr8 于 2009-6-17 15:23 编辑

在文件头加#NoTrayIcon
至于不用点击
你有几个参数要设的
不知道你要怎么改
或者自己学学吧
 楼主| 发表于 2009-6-16 23:49:27 | 显示全部楼层
我是自己不会才接触的慢慢的学朋友你就帮帮我被QQ说我的871643081
交个朋友也好或者你帮弄好了给你酬谢也可以
发表于 2009-6-17 14:43:10 | 显示全部楼层
论坛就是分享和互助
钱就没必要了
相信大家也不缺那几个钱
你把你的要求写清楚一点
谁有兴趣谁就帮你写完它
貌似也不是很难完成的
 楼主| 发表于 2009-6-18 03:59:24 | 显示全部楼层
谢谢你,我是不会写真的会就自己写了学习的一段时间的。
那个朋友有时间帮我写完他我谢谢了。
运行以后不用点开始才工作,还有就是执行这个脚本以后都在后台隐藏运行。
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_outfile=搜索引擎工具.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Winapi.au3>
#include <IE.au3>
#Include <File.au3>
HotKeySet("{f3}","ieshow1")
HotKeySet("{f4}","winshow1")
while 1
$sFilePath = FileOpenDialog( "请选择随即关键词txt文件", @ScriptDir, "(*.txt)", 3)
If @error Then
    MsgBox(0,"","你没有选择任何文件,程序将退出。")
        Exit
EndIf
ExitLoop
WEnd
$uur=""
$hanghao = _FileCountLines($sFilePath)
$oIE = _IECreate ("about:blank",1,0,0,-1);打开网页,可以隐藏IE
_IEPropertySet ($oIE, "toolbar", 0) ;隐藏toolbar
_IEPropertySet ($oIE, "width", 400) ;设置ie宽800像素
_IEPropertySet ($oIE, "height", 400) ;设置ie高600像素
_IEPropertySet ($oIE, "resizable", 0) ;设置ie不可以调整大小
$suiji = 0
$xunhuan = 0
$chaoshi = 0
$dangqian = 0
$tongji = 0
$line = "请输入关键词"
opt("guiOneventMode",1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("程序配置", 257, 195, 192, 150)
GUISetOnEvent($gui_event_close,"Close_Click",$Form1)
$Label0 = GUICtrlCreateLabel("URL:", 8, 10, 28, 17)
$Combo1 = GUICtrlCreateCombo("", 38, 8, 211, 25)
gengxin($uur)
$Group1 = GUICtrlCreateGroup("配置", 8, 33, 241, 137)
$Button1 = GUICtrlCreateButton("开始", 144, 49, 97, 89, $WS_GROUP)
GUICtrlSetOnEvent(-1,"RUNSTART")
$Label1 = GUICtrlCreateLabel("当前:"&$dangqian&"\统计:"&$tongji&"\词库:"&$hanghao, 8, 177, 200, 17)
GUICtrlSetColor(-1, 0x716F64)
$Checkbox1 = GUICtrlCreateCheckbox("显示IE窗口[F3]", 16, 49, 100, 17)
GUICtrlSetOnEvent(-1,"ieshow")
$Checkbox2 = GUICtrlCreateCheckbox("随机使用词库", 16, 97, 89, 17)
GUICtrlSetOnEvent(-1,"suiji")
$Checkbox3 = GUICtrlCreateCheckbox("循环使用词库", 16, 121, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("设置页面超时", 16, 145, 94, 17)
GUICtrlSetOnEvent(-1,"chaoshi")
$Input1 = GUICtrlCreateInput("1000", 112, 145, 49, 21)
GUICtrlSetState ($Input1,$GUI_DISABLE)
$Label2 = GUICtrlCreateLabel("毫秒", 168, 148, 28, 17)
$Checkbox5 = GUICtrlCreateCheckbox("隐藏当前窗体[F4]", 16, 73, 113, 17)
GUICtrlSetOnEvent(-1,"winshow")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Func gengxin(ByRef $uur)
        $URLL=IniReadSection("URL.INI","URL")
If @error Then
    $sData = "1=http://www.sogou.com/sogou?query=" & @LF & "2=http://www.baidu.com/s?wd=" & @LF & "3=http://www.google.cn/search?hl=zh-CN&q="& @LF & "4=http://www.gougou.com/search?search="
IniWriteSection("URL.INI","URL", $sData)
Else
        if $URLL[0][0] >1 Then
    For $i = 1 To $URLL[0][0]-1
$uur=$uur&$URLL[$i][1]&"|"
    Next
$uur=$uur&$URLL[$URLL[0][0]][1]
Else
        $uur=$uur&$URLL[$URLL[0][0]][1]
EndIf
EndIf
        GUICtrlSetData ($Combo1,$uur,$URLL[1][1])
EndFunc


Func RUNSTART()
if         GUICtrlRead ($Button1) = "开始" then
GUICtrlSetData ($Button1,"暂停")
Else
GUICtrlSetData ($Button1,"开始")
EndIf
EndFunc
Func Close_Click()
        _IEQuit ($oIE)
        Exit
EndFunc
Func ieshow1()
if BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED) Then
GUICtrlSetState ( $Checkbox1, $GUI_UNCHECKED )
Else
GUICtrlSetState ( $Checkbox1, $GUI_CHECKED )
EndIf
ieshow()
EndFunc
Func winshow1()
if BitAnd(GUICtrlRead($Checkbox5),$GUI_CHECKED) Then
GUICtrlSetState ( $Checkbox5, $GUI_UNCHECKED )
Else
GUICtrlSetState ( $Checkbox5, $GUI_CHECKED )
EndIf
winshow()
EndFunc
Func ieshow()
if BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED) Then
        _IEAction ($oIE,"visible")        
Else
        _IEAction ($oIE,"invisible")
EndIf
EndFunc
Func winshow()
if BitAnd(GUICtrlRead($Checkbox5),$GUI_CHECKED) Then
        GUISetState(@SW_HIDE,$Form1)
Else
        GUISetState(@SW_SHOW,$Form1)
EndIf
EndFunc

Func bianliang(ByRef $suiji,ByRef $xunhuan,ByRef $chaoshi)
if BitAnd(GUICtrlRead($Checkbox2),$GUI_CHECKED)Then
$suiji = 1               
$xunhuan = 1
Else
$suiji = 0
EndIf
if BitAnd(GUICtrlRead($Checkbox3),$GUI_CHECKED)Then
$xunhuan = 1
Else
$xunhuan = 0
EndIf
if BitAnd(GUICtrlRead($Checkbox4),$GUI_CHECKED)Then
$chaoshi = 1               
Else
$chaoshi = 0
EndIf
EndFunc


Func suiji()
if BitAnd(GUICtrlRead($Checkbox2),$GUI_CHECKED)Then
GUICtrlSetState ( $Checkbox3, $GUI_CHECKED )
GUICtrlSetState ( $Checkbox3,$GUI_DISABLE)
Else
GUICtrlSetState ( $Checkbox3,$GUI_ENABLE)
EndIf
EndFunc
Func chaoshi()
if BitAnd(GUICtrlRead($Checkbox4),$GUI_CHECKED)Then
GUICtrlSetState ( $Input1,$GUI_ENABLE)
Else
GUICtrlSetState ( $Input1,$GUI_DISABLE)
EndIf
EndFunc


While 1
bianliang($suiji,$xunhuan,$chaoshi)
if         GUICtrlRead ($Button1) = "开始" then
Sleep(0)
Else
guanjian($suiji,$hanghao,$dangqian,$xunhuan,$sFilePath,$line)
if         GUICtrlRead ($Button1) = "暂停" then
_IENavigate ($oIE, GUICtrlRead($Combo1)&$line, 1 )
$tongji = $tongji+1
EndIf
GUICtrlSetData ($Label1,"当前:"&$dangqian&"\统计:"&$tongji&"\词库:"&$hanghao)
yanshi()
EndIf
WEnd

Func yanshi()
        if $chaoshi = 1 Then
sleep(GUICtrlRead($Input1))               
Else
        _IELoadWait        ($oIE)
EndIf
EndFunc



Func guanjian($suiji,$hanghao,ByRef $dangqian,$xunhuan,$sFilePath,ByRef $line)
if $suiji = 1 Then
        $dangqian = Random (1, $hanghao, 1)
Else
        if $dangqian < $hanghao then
                $dangqian = $dangqian +1
        Else
                if $xunhuan = 1 Then
                $dangqian = 1        
                Else
                wancheng($hanghao)
                $dangqian = 0
                EndIf        
        EndIf
EndIf
$file = FileOpen($sFilePath, 0)
$line = FileReadLine($file,$dangqian)
FileClose($file)
EndFunc
Func wancheng($hanghao)
MsgBox(4096,"任务完成","关键词库共有"&$hanghao&"词条,现已读取到最后一个。")
GUICtrlSetData ($Button1,"开始")
EndFunc
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-26 08:25 , Processed in 0.114139 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表