Jump to content

Iniwrite and such....


Roofel
 Share

Recommended Posts

Hello:) While scripting ive encountered a minor problem with IniWrite:S

Currently in the script i got a list that records what is being typed into an input and adds it to the list.

All the values inside this list is being written into a .ini file at exit and then loaded into the list when the program starts up again:)

The problem lies somewhere inside this script:S

#include <GUIConstants.au3>
#include <IE.au3>

Opt("TrayMenuMode",1)
Opt("GUIDataSeparatorChar",2)
HotKeySet("{Esc}", "Close") ;---Used while scripting:)


$Form1= GUICreate("Find Airlines!", 403, 251, 616, 455)
$Group1= GUICtrlCreateGroup("Search", 8, 8, 385, 233)
$Button1= GUICtrlCreateButton("Google", 72, 72, 81, 49, 0)
$Button2= GUICtrlCreateButton("Yahoo!", 160, 72, 81, 49, 0)
$Button3= GUICtrlCreateButton("Kvasir", 248, 72, 81, 49, 0)
$Label2= GUICtrlCreateLabel("With", 20, 87, 52, 25)
$List1= GUICtrlCreateList("", 32, 123, 337, 71)
$Input1= GUICtrlCreateInput("", 80, 39, 193, 21)
$Label1= GUICtrlCreateLabel("Search for", 16, 40, 52, 17)
$Listbtn=GUICtrlCreateButton("Add search to list", 280, 30, 100, 40)
$Writebtn=GUICtrlCreateButton("Save searches", 32, 200, 169, 30)
$Remove=GUICtrlCreateButton("Remove selected", 202, 200, 169, 30)
$Menu=GUICtrlCreateContextMenu($List1)
$Item1=GUICtrlCreateMenuItem("Add to search bar", $Menu)
$Item2=GUICtrlCreateMenuItem("Remove from list", $Menu)
$Iniload=IniRead("Search.ini", "Main", "Data", "")
$Restore=TrayCreateItem("Restore Window")
$Nothing=TrayCreateItem("")
$About=TrayCreateItem("About")
$Exit=TrayCreateItem("Exit program")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
GUICtrlSetData($List1, $Iniload)


While 1
    $nMsg = GUIGetMsg()
    WinSetOnTop($Form1, "", 1)
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE, $Form1)
        Case $Listbtn
            GUICtrlSetData($List1,Guictrlread($Input1))
        Case $Remove
            
        Case $Writebtn
            IniWrite("Search.ini", "Main", "Data", GUICtrlRead($List1))
        Case $Button1
            _IECreate('http://www.google.com/search?q='&GUICtrlRead($Input1),1,1,0)
        Case $Button2
            _IECreate("http://www.kvasir.no/nettsok/searchResult.html?searchExpr="&GuiCtrlRead($Input1), 1,1,0)
        Case $Button3
            _IECreate("http://search.yahoo.com/search;_ylt=A0geu9fhcrlHOHUB1JxXNyoA?p="&GUICtrlRead($Input1), 1,1,0)
        Case $Item1
            GUICtrlSetData($Input1, GuictrlRead($List1))
        Case $Item2

    EndSwitch
    $Msg=TrayGetMsg()
    Select
    Case $Msg=$Restore
        GUISetState(@SW_SHOW, $Form1)
        Case $Msg=$About
            MsgBox(64, "about:", "This program was created by Roofel using the amazing software AutoIt")
        Case $Msg=$Exit
            Exit
    EndSelect
WEnd

Func Close()
    Exit
EndFunc

I feel something is wrong with the iniwrite but when i put "GuiCtrlRead($List1)" it writes GuiCtrlRead($List1) into the .ini file so something gotta be wrong with the $List1 but i cant find out what:S

Also another thing, How can i get it so that the item that is selected gets deleted but nothing else?

Tried using GuiCtrlSetData($List1, "") but that removed everything... And the script wont work if i use ListView instead of List:S

Anyone able to help?:)

Hope you understand my english;)

Roofel

Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D

Link to comment
Share on other sites

None knows?:S

Had the delete function on my computer earlier but then whole system crashed and i lost it and cant bloody find it again:(

Edited by Roofel

Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D

Link to comment
Share on other sites

  • Developers

Could you just wait a while before bumping or are you the one that payed for premium support?

If so you need to include the premium support code we gave you.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I Dont Really Understand What Your Asking.

Well, can you see anything wrong with the IniWrite in the script? Since it works only from time to time:S

And when i have multiple items in the list, how can i only remove the one i have highlighted? when i try to use GuiCtrlSetData($List1, "") it removes everything in he list:S

Could you just wait a while before bumping or are you the one that payed for premium support?

If so you need to include the premium support code we gave you.

Sorry<.< My clock goes faster than usual it appears. Had 1 hour between the reply's according to my clock...

Never argue with an idiot, he will just bring you down to his own level and beat you with experience! :D

Link to comment
Share on other sites

And when i have multiple items in the list, how can i only remove the one i have highlighted? when i try to use GuiCtrlSetData($List1, "") it removes everything in he list:S

Ofcource everything is removed if you tell him to remove everything :) but seriously, if you only want to remove the selected I believe you should try _GUICtrlListBox_GetCurSel to get the currently selected and _GUICtrlListBox_DeleteString to remove it
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...