Sign in to follow this  
Followers 0
LordJugag

Simplification of IniRead

18 posts in this topic

A part of the code...

Func _Recommendation()
    $_Next = $_Next + 1
    If $_Next > 2 Then 
        GUICtrlSetState ( $tm_recommendation, $GUI_DISABLE )
        MsgBox ( 0, 'Recommendation', 'Please try again later' )
    EndIf
    ConsoleWrite ( "$_Next : " & $_Next & @Crlf )
    Switch $_Next
        Case 1
            $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "FAVORIT", ""))
        Case 2
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_1", ""))
        Case 3
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_2", ""))
        Case 4
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_3", ""))
        Case 5
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_4", ""))
        Case 6
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_5", ""))
        Case 7
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_6", ""))
        Case 8
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_7", ""))
        Case 9
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_8", ""))
    EndSwitch
EndFunc   ;==>_Recommendation

Local Database.ini

[RECOMMENDATION]
RECOMMEND_1=www.domain1.com
RECOMMEND_2=www.domain2.com
RECOMMEND_3=
RECOMMEND_4=www.domain4.com
RECOMMEND_5=www.domain5.com
RECOMMEND_6=www.domain6.com
RECOMMEND_7=
RECOMMEND_8=
RECOMMEND_9=www.domain9.com

I want to simplify... as not to abuse of instruction Case and to jump to the next recommendation in case you miss address. How do that? Can you help me?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

A little simpler:

Func _Recommendation()
    $_Next += 1
    
    ; ...

    $sKey = "FAVORIT"
    If $_Next > 1 Then $sKey = "RECOMMEND_" & $_Next - 1
    $oIE.Navigate(IniRead($ini, "RECOMMENDATION", $sKey, ""))
EndFunc   ;==>_Recommendation

;)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Try this

Func _Recommendation()
    $_Next = $_Next + 1
    If $_Next > 2 Then 
    GUICtrlSetState ( $tm_recommendation, $GUI_DISABLE )
    MsgBox ( 0, 'Recommendation', 'Please try again later' )
    EndIf
    ConsoleWrite ( "$_Next : " & $_Next & @Crlf )
    Switch $_Next
    Case 1
    $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "FAVORIT", ""))
    Case Else
    $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_" & $_Next, ""))
    EndSwitch
EndFunc ;==>_Recommendation

Share this post


Link to post
Share on other sites

Try this

You didn't notice he needs "RECOMMEND_" & $_Next - 1. Plus that's six lines to my three...

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

A little simpler:

Func _Recommendation()
    $_Next += 1
    
    ; ...

    $sKey = "FAVORIT"
    If $_Next > 1 Then $sKey = "RECOMMEND_" & $_Next - 1
    $oIE.Navigate(IniRead($ini, "RECOMMENDATION", $sKey, ""))
EndFunc   ;==>_Recommendation

:)

Not work...

Try this

Func _Recommendation()
    $_Next = $_Next + 1
    If $_Next > 2 Then 
    GUICtrlSetState ( $tm_recommendation, $GUI_DISABLE )
    MsgBox ( 0, 'Recommendation', 'Please try again later' )
    EndIf
    ConsoleWrite ( "$_Next : " & $_Next & @Crlf )
    Switch $_Next
    Case 1
    $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "FAVORIT", ""))
    Case Else
    $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_" & $_Next, ""))
    EndSwitch
EndFunc ;==>_Recommendation

Not working properly... stop to Recomend_1, display MsgBox, loading Recomend_3 and there goes nothing ;) Edited by LordJugag

Share this post


Link to post
Share on other sites

Bovine Scat, "not work"!

Test1.ini

[RECOMMENDATION]
FAVORIT=www.autoitscript.com
RECOMMEND_1=www.groklaw.net
RECOMMEND_2=www.google.com
RECOMMEND_3=www.documentfoundation.org
RECOMMEND_4=www.ubuntu.com

Test1.au3

#include <IE.au3>

$_Next = 0
$ini = @ScriptDir & "\Test1.ini"
$oIE = _IECreate()
For $n = 1 To 5
    Sleep(3000)
    _Recommendation()
Next


Func _Recommendation()
    $_Next += 1

    ; ...

    $sKey = "FAVORIT"
    If $_Next > 1 Then $sKey = "RECOMMEND_" & $_Next - 1
    $oIE.Navigate(IniRead($ini, "RECOMMENDATION", $sKey, ""))
EndFunc   ;==>_Recommendation

Just as advertised.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Bovine Scat, "not work"!

Test1.ini

[RECOMMENDATION]
FAVORIT=www.autoitscript.com
RECOMMEND_1=www.groklaw.net
RECOMMEND_2=www.google.com
RECOMMEND_3=www.documentfoundation.org
RECOMMEND_4=www.ubuntu.com

Test1.au3

#include <IE.au3>

$_Next = 0
$ini = @ScriptDir & "\Test1.ini"
$oIE = _IECreate()
For $n = 1 To 5
    Sleep(3000)
    _Recommendation()
Next


Func _Recommendation()
    $_Next += 1

    ; ...

    $sKey = "FAVORIT"
    If $_Next > 1 Then $sKey = "RECOMMEND_" & $_Next - 1
    $oIE.Navigate(IniRead($ini, "RECOMMENDATION", $sKey, ""))
EndFunc   ;==>_Recommendation

Just as advertised.

;)

I do not want to do Sleep. I'm interested in something similar script jaberwocky6669's

Share this post


Link to post
Share on other sites

I do not want to do Sleep. I'm interested in something similar script jaberwocky6669's

The Sleep? What's the Sleep() got to do with anything? :)

That part of the script just simulates the parts of your script that you didn't post so it would be an actual running demo (which it is). The technique used in _Recommendation() was the only part of interest.

Make a similar short, complete demo of your own that we can run to see what your issue is.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Maybe it is Sleep that has something to do with it because when you are not sleeping for a longer period you can't think clear anymore. ;)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Full source...

#NoTrayIcon
#Include <INet.au3>
#Include <String.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>

Global $oIE = ObjCreate("Shell.Explorer.2")
Global $ini = "C:\Browser Database\Log.ini"
Global $db = "C:\Browser Database\Database.ini"
Global $_Next
Global $read_height = IniRead($ini, "DISPLAY", "HEIGHT", "")
Global $read_width = IniRead($ini, "DISPLAY", "WIDTH", "")
Global $read_homepage = IniRead($ini, "Settings", "Homepage", "")
Global $read_starthomepage = IniRead($ini, "Settings", "StartHomepage", "")
Global $read_firstrecruit  = IniRead($ini, "RECOMMENDATION", "FAVORIT", "")

If $read_height = "" Then
    IniWrite($ini, "DISPLAY", "HEIGHT", "600")
    IniWrite($ini, "DISPLAY", "WIDTH", "800")
    $read_height = 600
    $read_width = 800
EndIf

If $read_starthomepage = "" Then
    $read_starthomepage = "1"
    $read_homepage = "http://www.google.com"
EndIf

If $read_firstrecruit = "" Then
    IniWrite($ini, "RECOMMENDATION", "FAVORIT", "http://www.autoitscript.com")
EndIf

$iniread = IniRead($ini, "URL", "LAST URL", "")
If $read_starthomepage = "0" Then $read_homepage = $iniread

$gui_main = GUICreate("", $read_width, $read_height + 20, -1, -1, 0x04000000 + 0x00CF0000)
$file_menu = GUICtrlCreateMenu("File")
$fm_open = GUICtrlCreateMenuItem("Open", $file_menu)
$fm_sep = GUICtrlCreateMenuItem("", $file_menu)
$fm_print = GUICtrlCreateMenuItem("Print", $file_menu)
$fm_sep = GUICtrlCreateMenuItem("", $file_menu)
$fm_savas = GUICtrlCreateMenuItem("Save As", $file_menu)
$fm_SaveSource = GUICtrlCreateMenuItem("Save Source", $file_menu)
$fm_sep = GUICtrlCreateMenuItem("", $file_menu)
$fm_exit = GUICtrlCreateMenuItem("Exit", $file_menu)

$fav_menu = GUICtrlCreateMenu("Favorites")
$fav1 = GUICtrlCreateMenuItem("Google", $fav_menu)
$fav2 = GUICtrlCreateMenuItem("AutoIT", $fav_menu)

$tool_menu = GUICtrlCreateMenu("Tools")
$tm_recommendation = GUICtrlCreateMenuItem("Recommendation", $tool_menu)
$tm_locator = GUICtrlCreateMenuItem("Locator", $tool_menu)

$about_menu = GUICtrlCreateMenu("About")
$am_about = GUICtrlCreateMenuItem("About", $about_menu)

$gui_iewindow = GUICtrlCreateObj($oIE, 0, 0, $read_width, $read_height - 15)
GUICtrlSetResizing($gui_iewindow, 0x0001)
$status_bar = GUICtrlCreateLabel("Loading: " & $read_homepage & "...", 0, 584, $read_width, $read_height, BitOR(11, 0x1000))
GUISetState()

AnimateTitle($gui_main, "Browser - Created by Justin Reno/Modified by LordJugag", 100)
$oIE.Navigate ($read_homepage)

While 1
    WinSetTitle($gui_main, "", "Browser - Created by Justin Reno/Modified by LordJugag - " & $oIE.locationURL ())
    
    If $oIE.Busy () Then
        $url = $oIE.LocationURL ()
        _StatusChange("Loading: " & $url & "...")
    Else
        _StatusChange("Done.")
    EndIf

    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case - 3
            $update = $oIE.LocationURL ()
            IniWrite($ini, "URL", "LAST URL", $update)
            Exit
            ;File Menu
        Case $fm_open
            Local $file = FileOpenDialog("Browser : Select file", @ScriptDir, "All Files (*.*)")
            If @error <> 1 Then
                _StatusChange("Loading: " & $file & "...")
                $oIE.Navigate ($file)
            EndIf
        Case $fm_print
            $oIE.document.parentwindow.Print ()
        Case $fm_savas
            $oIE.document.execCommand ("SaveAs")
        Case $fm_SaveSource
            $IE = _INetGetSource("" & $update & "")
            FileWrite(@DesktopDir & "\websource.html", $IE)
            MsgBox(0, "Browser", "Saved to desktop as websource.html")
        Case $fm_exit
            $update = $oIE.LocationURL ()
            IniWrite($ini, "URL", "LAST URL", $update)
            Exit
            ;Favorites Menu
        Case $fav1
            $oIE.Navigate ("http://www.google.com")
        Case $fav2
            $oIE.Navigate ("http://www.autoitscript.com")
            ;Recruiter Menu
        Case $tm_recommendation
            _Recommendation()
            $url = "http://aorr.110mb.com/Database.ini"
            $folder = "C:\Browser Database\"
            If Not FileExists($folder) Then DirCreate($folder) ;InetGet doesn't create the destination folder for you.
            InetGet($url,$folder & StringTrimLeft($url,StringInStr($url,"/",Default,-1)))
        Case $tm_locator    
            Global $Bin = InetRead ("http://www.ip-details.com/ip-search/")
            Global $Page = BinaryToString ($Bin)
            $Address = _StringBetween ($Page, 'addressspan">' , '</span>')
            $country = _StringBetween($page, 'countryspan">' , '</span>')
            $longlat = _StringBetween ($page, 'latlongspan">' , '</span>')
            $longlatstring = _ArrayToString($longlat)
            $longlatstring2 = StringStripWS ($longlatstring, 1)
            msgbox (0, '' , $country[0] & ", Nice Country!" & "  People are now en route to " & $Address[0] & "." & "  Weaponary is now aimed at " & $longlatstring2)
            ;About Menu
        Case $am_about
            MsgBox ( 0, 'About', 'Browser - version alpha')
    EndSwitch
WEnd

Func _StatusChange($message)
    GUICtrlSetData($status_bar, $message)
EndFunc   ;==>_StatusChange

Func _Recommendation()
    $_Next = $_Next + 1
    If $_Next > 4 Then 
        GUICtrlSetState ( $tm_recommendation, $GUI_DISABLE )
        MsgBox ( 0, 'Recommendation', 'Please try again later' )
    EndIf
    ConsoleWrite ( "$_Next : " & $_Next & @Crlf )
    Switch $_Next
        Case 1
            $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "FAVORIT", ""))
        Case 2
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_1", ""))
        Case 3
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_2", ""))
        Case 4
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_3", ""))
    EndSwitch
EndFunc   ;==>_Recommendation

Func AnimateTitle($hGUI, $sTitle, $iBuf)
    $sTitle = StringSplit($sTitle, "")
    For $i = $iBuf To 0 Step - 1
        WinSetTitle($hGUI, "", _StringRepeat(" ", $i) & $sTitle[1])
    Next
    Local $s
    For $i = 1 To $sTitle[0]
        $s &= $sTitle[$i]
        WinSetTitle($hGUI, "", $s)
        Sleep(5)
    Next
EndFunc   ;==>AnimateTitle
Edited by LordJugag

Share this post


Link to post
Share on other sites

Full source...

Func _Recommendation()
    $_Next = $_Next + 1
    If $_Next > 4 Then 
        GUICtrlSetState ( $tm_recommendation, $GUI_DISABLE )
        MsgBox ( 0, 'Recommendation', 'Please try again later' )
    EndIf
    ConsoleWrite ( "$_Next : " & $_Next & @Crlf )
    Switch $_Next
        Case 1
            $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "FAVORIT", ""))
        Case 2
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_1", ""))
        Case 3
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_2", ""))
        Case 4
            $oIE.Navigate (IniRead($db, "RECOMMENDATION", "RECOMMEND_3", ""))
    EndSwitch
EndFunc   ;==>_Recommendation
I missed that you switched from $ini to $db for the INI source file, but that just makes it this:
Func _Recommendation()
    $_Next += 1
    If $_Next > 4 Then
        GUICtrlSetState($tm_recommendation, $GUI_DISABLE)
        MsgBox(0, 'Recommendation', 'Please try again later')
    EndIf
    Local $sKey = "FAVORIT", $sFile = $ini
    If $_Next > 1 Then Local $sKey = "RECOMMEND_" & $_Next - 1, $sFile = $db
    $oIE.Navigate(IniRead($sFile, "RECOMMENDATION", $sKey, ""))
EndFunc   ;==>_Recommendation
And it still works the same as what you had.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

With a single ini.

with line 22 ($n = 5):

If there is no favorite it shows the recommendations, If there is a favorite it just opens that page.

without line 22 ($n = 5):

If there is no favorite it only opens recommendations, If there is a favorite it opens that one along with all the recommendations.

#include <IE.au3>
#include <GUIConstantsEx.au3>

$_Next = 0
$ini = @ScriptDir & "\Test1.ini"
$oIE = _IECreate()
For $n = 1 To 5
    _Recommendation()
Next

Func _Recommendation()
$_Next = $_Next + 1
    ConsoleWrite ( "$_Next : " & $_Next & @Crlf )
    If $_Next = 1 Then
    $Checkini = IniRead($ini, "FAVORIT", "FAVORIT", "about:blank")
      If $Checkini = "about:blank" Then
           $_Next = 2
           $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "RECOMMEND_" & $_Next, ''))

       Else
            $oIE.Navigate (IniRead($ini, "FAVORIT", "FAVORIT", ""))
            $n = 5
           Endif
         Endif

If $_Next > 1 Then
    $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "RECOMMEND_" & $_Next, ''), 0x0800)
EndIf
EndFunc ;==>_Recommendation
Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

I missed that you switched from $ini to $db for the INI source file, but that just makes it this:

Func _Recommendation()
    $_Next += 1
    If $_Next > 4 Then
        GUICtrlSetState($tm_recommendation, $GUI_DISABLE)
        MsgBox(0, 'Recommendation', 'Please try again later')
    EndIf
    Local $sKey = "FAVORIT", $sFile = $ini
    If $_Next > 1 Then Local $sKey = "RECOMMEND_" & $_Next - 1, $sFile = $db
    $oIE.Navigate(IniRead($sFile, "RECOMMENDATION", $sKey, ""))
EndFunc   ;==>_Recommendation
And it still works the same as what you had.

;)

Thank you... very good.

With a single ini.

with line 22 ($n = 5):

If there is no favorite it shows the recommendations, If there is a favorite it just opens that page.

without line 22 ($n = 5):

If there is no favorite it only opens recommendations, If there is a favorite it opens that one along with all the recommendations.

#include <IE.au3>
#include <GUIConstantsEx.au3>

$_Next = 0
$ini = @ScriptDir & "\Test1.ini"
$oIE = _IECreate()
For $n = 1 To 5
    _Recommendation()
Next

Func _Recommendation()
$_Next = $_Next + 1
    ConsoleWrite ( "$_Next : " & $_Next & @Crlf )
    If $_Next = 1 Then
    $Checkini = IniRead($ini, "FAVORIT", "FAVORIT", "about:blank")
      If $Checkini = "about:blank" Then
           $_Next = 2
           $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "RECOMMEND_" & $_Next, ''))

       Else
            $oIE.Navigate (IniRead($ini, "FAVORIT", "FAVORIT", ""))
            $n = 5
           Endif
         Endif

If $_Next > 1 Then
    $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "RECOMMEND_" & $_Next, ''), 0x0800)
EndIf
EndFunc ;==>_Recommendation

C:\Program Files\AutoIt3\Examples\Project 3.au3 (158) : ==> The requested action with this object has failed.:

$oIE.Navigate (IniRead($ini, "RECOMMENDATION", "RECOMMEND_" & $_Next, ''), 0x0800)

$oIE.Navigate (IniRead($ini, "RECOMMENDATION", "RECOMMEND_" & $_Next, ''), 0x0800)^ ERROR

Share this post


Link to post
Share on other sites

that just opens the window in a new tab, I cant determine why a window wouldnt already be open when you get to that line....you may need my ini since i modified it and all ;)

Test1.ini

[RECOMMENDATION]
RECOMMEND_2=www.groklaw.net
RECOMMEND_3=www.google.com
RECOMMEND_4=www.documentfoundation.org
RECOMMEND_5=www.ubuntu.com
[FAVORIT]
FAVORIT =www.autoitscript.com

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

that just opens the window in a new tab, I cant determine why a window wouldnt already be open when you get to that line....you may need my ini since i modified it and all ;)

Test1.ini

[RECOMMENDATION]
RECOMMEND_2=www.groklaw.net
RECOMMEND_3=www.google.com
RECOMMEND_4=www.documentfoundation.org
RECOMMEND_5=www.ubuntu.com
[FAVORIT]
FAVORIT =www.autoitscript.com

I used your file INI .... I see the same error

Share this post


Link to post
Share on other sites

i had some checks out of order that would have caused that error in certain cases. Maybe this improves behavior?

#include <IE.au3>
#include <GUIConstantsEx.au3>

$_Next = 0
$ini = @ScriptDir & "\Test1.ini"
$oIE = _IECreate()
For $n = 1 To 5
    _Recommendation()
Next

Func _Recommendation()
$_Next = $_Next + 1

If $_Next > 1 Then
    $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "RECOMMEND_" & $_Next, ''), 0x0800)
EndIf


    ConsoleWrite ( "$_Next : " & $_Next & @Crlf )
    If $_Next = 1 Then
    $Checkini = IniRead($ini, "FAVORIT", "FAVORIT", "about:blank")
      If $Checkini = "about:blank" Then
           $_Next = 2
           $n = 2
           $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "RECOMMEND_" & $_Next, ''))

       Else
            $oIE.Navigate (IniRead($ini, "FAVORIT", "FAVORIT", ""))
            $_Next = 1
           Endif
         Endif


EndFunc ;==>_Recommendation

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

i had some checks out of order that would have caused that error in certain cases. Maybe this improves behavior?

#include <IE.au3>
#include <GUIConstantsEx.au3>

$_Next = 0
$ini = @ScriptDir & "\Test1.ini"
$oIE = _IECreate()
For $n = 1 To 5
    _Recommendation()
Next

Func _Recommendation()
$_Next = $_Next + 1

If $_Next > 1 Then
    $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "RECOMMEND_" & $_Next, ''), 0x0800)
EndIf


    ConsoleWrite ( "$_Next : " & $_Next & @Crlf )
    If $_Next = 1 Then
    $Checkini = IniRead($ini, "FAVORIT", "FAVORIT", "about:blank")
      If $Checkini = "about:blank" Then
           $_Next = 2
           $n = 2
           $oIE.Navigate (IniRead($ini, "RECOMMENDATION", "RECOMMEND_" & $_Next, ''))

       Else
            $oIE.Navigate (IniRead($ini, "FAVORIT", "FAVORIT", ""))
            $_Next = 1
           Endif
         Endif


EndFunc ;==>_Recommendation

Now it works properly... but missing instructions

GUICtrlSetState($tm_recommendation, $GUI_DISABLE)
        MsgBox(0, 'Recommendation', 'Please try again later')

Share this post


Link to post
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
Sign in to follow this  
Followers 0