Jump to content

load a variable


spillo3000
 Share

Recommended Posts

hi people ,

i must create a script that improve the web page rank and i use some script from the forum but i'll find some trouble when the secod script "cron" read the variable from a ini file, because read Host=www.pippo.com .

this is the first script :

CODE

#include <GUIConstants.au3>

#include <File.au3>

#include <misc.au3>

Global $start

Global $way1x

$showGUI = 0 ; setting the GUI condition

HotKeySet("{F6}", "show") ; using hotkey to show menu

Read()

GUICreate("Improve Web Page Rank V.1.0 ", 340, 250)

$savebotbutt = GUICtrlCreateButton("Salva", 170, 210, 50, 30) ; visualizza il bottone salva

$exitbotbutt = GUICtrlCreateButton("Uscita", 220, 210, 50, 30) ; visualizza il bottone uscita

$startservice = GUICtrlCreateButton ( "AvviaCron", 110, 210, 60, 30) ; visualizza il bottone del servizio cron

$stopservice = GUICtrlCreateButton ( "StopCron", 50, 210, 60, 30) ; visualizza il bottone del servizio cron

GUICtrlCreateTab(0, 0, 290, 390)

$tab2 = GUICtrlCreateTabItem("Menu")

GUICtrlCreateLabel("Hostname Sito Web", 10, 30, 200, 20)

GUICtrlCreateLabel ( "Hostname", 10, 50, 50, 20)

;~ $way1x = IniRead(".\improve_rank_page.ini","Hostname","Host","")

$input_x = GUICtrlCreateInput($way1x, 80, 50, 200, 20)

GUISetState(@SW_HIDE)

While 1 ; main body of program, loop till condition met

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE ; when the top right cancel button is pressed

Exit

Case $msg = $savebotbutt ; pressing the Save button

Write()

MsgBox(64, "Salvato", "Hai salvato il nuovo host !")

Case $msg = $exitbotbutt ; pressing the Exit button

Exit

Case $msg = $startservice ; avvio del servizio cron

ShellExecute ( "cron.exe", @SW_HIDE)

MsgBox(64, "Avviato", "Avvio Cron !")

Case $msg = $stopservice ; stop del servizio cron

ProcessClose ( "cron.exe")

MsgBox(64, "Fermato", "Fermo Cron !")

EndSelect

WEnd

;;-------------------------------------- Functions --------------------------------

Func show()

If $showGUI = 0 Then

Read()

GUISetState(@SW_SHOW) ; show the menu when hotkey pressed

$showGUI = 1

Else

GUISetState(@SW_HIDE) ; hide the menu when hotkey pressed

$showGUI = 0

EndIf

EndFunc ;==>show

Func Write()

IniWrite(".\improve_rank_page.ini", "Hostname", "Host", GUICtrlRead($input_x))

EndFunc ;==>Write

Func Read()

$way1x = IniRead(".\improve_rank_page.ini", "Hostname", "Host", "")

EndFunc ;==>Read

this is the second script :

CODE
#NoTrayIcon

#include <IE.au3>

#include <File.au3>

global $url = IniRead(".\improve_rank_page.ini", "Hostname", "Host", "")

if RegRead( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" ,"bot_cron") <> @ScriptDir & "\cron.exe" then

RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" ,"bot_cron", "REG_SZ", @ScriptDir & "\cron.exe" )

endif

while 1

_IELoadWait ($url)

Sleep(1000)

_IEAction($url, "refresh")

WEnd

how can i load a variable with no Host= , please need help..

Stefano

Link to comment
Share on other sites

hi people ,

i must create a script that improve the web page rank and i use some script from the forum but i'll find some trouble when the secod script "cron" read the variable from a ini file, because read Host=www.pippo.com .

this is the first script :

CODE

#include <GUIConstants.au3>

#include <File.au3>

#include <misc.au3>

Global $start

Global $way1x

$showGUI = 0 ; setting the GUI condition

HotKeySet("{F6}", "show") ; using hotkey to show menu

Read()

GUICreate("Improve Web Page Rank V.1.0 ", 340, 250)

$savebotbutt = GUICtrlCreateButton("Salva", 170, 210, 50, 30) ; visualizza il bottone salva

$exitbotbutt = GUICtrlCreateButton("Uscita", 220, 210, 50, 30) ; visualizza il bottone uscita

$startservice = GUICtrlCreateButton ( "AvviaCron", 110, 210, 60, 30) ; visualizza il bottone del servizio cron

$stopservice = GUICtrlCreateButton ( "StopCron", 50, 210, 60, 30) ; visualizza il bottone del servizio cron

GUICtrlCreateTab(0, 0, 290, 390)

$tab2 = GUICtrlCreateTabItem("Menu")

GUICtrlCreateLabel("Hostname Sito Web", 10, 30, 200, 20)

GUICtrlCreateLabel ( "Hostname", 10, 50, 50, 20)

;~ $way1x = IniRead(".\improve_rank_page.ini","Hostname","Host","")

$input_x = GUICtrlCreateInput($way1x, 80, 50, 200, 20)

GUISetState(@SW_HIDE)

While 1 ; main body of program, loop till condition met

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE ; when the top right cancel button is pressed

Exit

Case $msg = $savebotbutt ; pressing the Save button

Write()

MsgBox(64, "Salvato", "Hai salvato il nuovo host !")

Case $msg = $exitbotbutt ; pressing the Exit button

Exit

Case $msg = $startservice ; avvio del servizio cron

ShellExecute ( "cron.exe", @SW_HIDE)

MsgBox(64, "Avviato", "Avvio Cron !")

Case $msg = $stopservice ; stop del servizio cron

ProcessClose ( "cron.exe")

MsgBox(64, "Fermato", "Fermo Cron !")

EndSelect

WEnd

;;-------------------------------------- Functions --------------------------------

Func show()

If $showGUI = 0 Then

Read()

GUISetState(@SW_SHOW) ; show the menu when hotkey pressed

$showGUI = 1

Else

GUISetState(@SW_HIDE) ; hide the menu when hotkey pressed

$showGUI = 0

EndIf

EndFunc ;==>show

Func Write()

IniWrite(".\improve_rank_page.ini", "Hostname", "Host", GUICtrlRead($input_x))

EndFunc ;==>Write

Func Read()

$way1x = IniRead(".\improve_rank_page.ini", "Hostname", "Host", "")

EndFunc ;==>Read

this is the second script :

CODE
#NoTrayIcon

#include <IE.au3>

#include <File.au3>

global $url = IniRead(".\improve_rank_page.ini", "Hostname", "Host", "")

if RegRead( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" ,"bot_cron") <> @ScriptDir & "\cron.exe" then

RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" ,"bot_cron", "REG_SZ", @ScriptDir & "\cron.exe" )

endif

while 1

_IELoadWait ($url)

Sleep(1000)

_IEAction($url, "refresh")

WEnd

how can i load a variable with no Host= , please need help..

Stefano

I don't see that you are correct. It looks to me like the second script will read the text entered in the input in the first script.

Maybe I don't understand your question. When you ask 'how can I load a variable with no Host=' do you mean you want to find the variable without using an ini file?

Oh I just noticed, welcome to the forums :)

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

How can i load the web site saved in improve_rank_page.ini from the second script ? And connect to that site automatically ? or there is another method to solve my problem ?

Using an idea from example scripts

#NoTrayIcon
global $url = IniRead(".\improve_rank_page.ini", "Hostname", "Host", "")

$Form1 = GUICreate("mini Browser", 800, 600)
$Obj1 = ObjCreate("Shell.Explorer.2")
$Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, 794, 570)
GUISetState(@SW_SHOW)
$Obj1.Navigate($url)
While GUIGetMsg() <> -3
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...