Jump to content

New to autoit scripting , need help with autosave script


 Share

Recommended Posts

I'm making a script to open up and save webpages, i think it would be useful to some who save pages often. But I have a couple of problems with it.

1. First of all the script seems to enter the length of the array and I don't know why that is happening.

2. Sometimes the save dialog appears when I don't want it to. (I need to bring it up after page load, which I'm using sleep for now with).

Could anyone give me any pointers on how to improve this script?

Thanks in advance

#include <GUIConstants.au3>
#include <IE.au3>
; == GUI generated with Koda ==);
$Form1 = GUICreate("AForm1", 284, 352, 345, 179)
$StartSav = GUICtrlCreateButton("Start ", 208, 320, 65, 25, 0)
$Group1 = GUICtrlCreateGroup("Sites", 8, 8, 273, 105)
GUICtrlCreateLabel("Enter sites seperated by commas to save.", 24, 24, 243, 17)
$Input1 = GUICtrlCreateInput("", 24, 48, 241, 53)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Browser", 8, 128, 273, 89)
GUICtrlCreateLabel("Select browser to Open and Save to, or enter browser path here.", 24, 152, 182, 30)
$Combo1 = GUICtrlCreateCombo("", 24, 188, 241, 21)
GUICtrlSetData(-1, "Internet Explorer|Firefox|Opera")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("AGroup3", 8, 232, 273, 81)
GUICtrlCreateLabel("Enter folder path to save to", 24, 248, 132, 17)
$Input2 = GUICtrlCreateInput("", 24, 272, 241, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        Exit 0
    EndIf
    If $msg = $StartSav Then
        StartSaving()
    EndIf
WEnd

Func StartSaving()
$sites=StringSplit(GUICtrlRead($Input1,0), ",")
    Select
        Case GUICtrlRead($Combo1,0) = "Internet Explorer"
_IECreate ("about:blank")
        Case GUICtrlRead($Combo1,0) = "Firefox"
            Run("C:\Program Files\Mozilla Firefox\firefox.exe", "", @SW_SHOW)
        Case GUICtrlRead($Combo1,0) = "Opera"
            Run("C:\Program Files\Opera\opera.exe", "", @SW_SHOW)
WinSetOnTop("Opera", "", 1)
Case Else
Run(GUICtrlRead($Combo1,0), "", @SW_SHOW)
    EndSelect
sleep(2000)
For $I = 0 to UBound( $sites ) - 1
send("{CTRLDOWN}{l down}{l up}{CTRLUP}")
sleep(500)
send($sites[$I])
send("{enter}")
sleep(10000)
send("{CTRLDOWN}{s down}{s up}{CTRLUP}")
send(GUICtrlRead($Input2,0))
send("{enter}")
$savefile=StringReplace($sites[$I], ".", "-")
$savefile=StringReplace($savefile, "http://", "",1)
$savefile=StringReplace($sites[$I], "/", "@")
send($savefile)
send("{enter}")
Next
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...