Jump to content

autocomplete with iniread() and own functions...


 Share

Recommended Posts

  • Moderators

jawed,

This thread offers a few examples to get you started. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

If you want specific help, you really need to give greater detail about your program, as it is not really clear what you are trying to achieve. We need an overall picture, not just elements you desire .... those elements need context.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

ok, here it is: my .ini file looks like:

[lbl_Wer ist Halter des Fahrzeuges?]
Text=Wer ist Halter des Fahrzeuges?
ID=Static1
X=264
Y=83
W=175
H=20

[cmb_Wer ist Halter des Fahrzeuges?]
Text=Firma / Geschäftsführer / Geschäftsinhaber
ID=ComboBox1
X=450
Y=81
W=380
H=20

[btn_Halter suchen]
Text=Halter suchen...
ID=Button1
X=870
Y=81
W=125
H=20

[lbl_Anrede / Titel]
Text=Anrede / Titel
ID=Static2
X=265
Y=116
W=106
H=20

[cmb_Anrede]
Text=Herr
ID=ComboBox2
X=410
Y=116
W=100
H=20

[edt_Titel]
Text=
ID=Edit1
X=515
Y=116
W=115
H=20

its saved in "C:Tempini1.ini"

i have in my autoit-file, which is also saved in "C:Temptool.au3"

it has functions like:

Func lbl($item, $vergleichswert)
      $ID=IniRead(@ScriptDir &"\ini1.ini", "lbl_" & $item, "ID", "notfound")
      $x=IniRead(@ScriptDir &"\ini1.ini", "lbl_" & $item, "X", "notfound")
      $y=IniRead(@ScriptDir &"\ini1.ini", "lbl_" & $item, "Y", "notfound")
   MouseMove($x+7, $y+7, 0)
   ;do something
EndFunc

Func cmb($item, $text)
      $ID=IniRead(@ScriptDir &"\ini1.ini", "cmb_" & $item, "ID", "notfound")
      $x=IniRead(@ScriptDir &"\ini1.ini", "cmb_" & $item, "X", "notfound")
      $y=IniRead(@ScriptDir &"\ini1.ini", "cmb_" & $item, "Y", "notfound")
   MouseMove($x+7, $y+7, 0)
   ControlSend($Caption, "", $ID, $text)
   ControlFocus($Caption, "", $ID)
EndFunc

now... is there a way WHILE coding, in this tool.au3, to use autocomplete?

like you see i have names in my ini-file like "cmb_Wer ist Halter des Fahrzeuges?" it would be mouch easier for me to let me see all names which starts with "cmb_" after typing "cmb(" or "cmb(cmb_".

hope this times its better explained...

Edited by jawed
Link to comment
Share on other sites

If you want specific help, you really need to give greater detail about your program, as it is not really clear what you are trying to achieve. We need an overall picture, not just elements you desire .... those elements need context.

 

its not something about my program... its more a big help while creating my program. so no gui's, its really just for me while coding to let me see all the names in my ini1.ini file and filter them based on what i'm typing

Edited by jawed
Link to comment
Share on other sites

  • Moderators

jawed,

I understand now - you want to add these ini section titles to the SciTE autocomplete list. One way to do this could be to create fake User CallTips - then the titles would act like AutoIt functions and should appear in the SciTE autocomplete list as you type. Let me have a play around this afternoon and I will see how it might be done. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

jawed,

I understand now - you want to add these ini section titles to the SciTE autocomplete list. One way to do this could be to create fake User CallTips - then the titles would act like AutoIt functions and should appear in the SciTE autocomplete list as you type. Let me have a play around this afternoon and I will see how it might be done. :)

M23

THAT is exactly what i wanted :D but not this way... i have about 20 .ini files with ~40 sections each. AND some of them have the same ini sections names... thats why i seperated them.

its a programm im controling, it has different pages and the ID of the controls every time start to count new. for example:

page 1 has: button1, button2, button3, label1-10

page 2 has: button1, button2, label1-5

...so these "ID's"  are just unique for each page, thats why i cannot throw them together :(

Link to comment
Share on other sites

  • Moderators

jawed,

Just as well I got diverted onto something else then. :D

I am out of ideas then - sorry. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 weeks later...

i have an idea.. but its... complicated. so i try to explain it:

i thought about using calltips. i've read that you can import your own file somewhere somehow, so that you just have 1 file with all of your own functions.

so here's my idea. 1 fix FILE, and every time im working on a specific page i write all the ini sections in my FILE, save it and then Restart SciTE.

something like:

if fileexists("FILE.x") then  
 filedelete("FILE.x")           ;i dont remember the ending.. ^^"  
 filecreate("FILE.x")
endif

while iniread <> 0              ; until end of my ini-file reached
 filewrite("FILE.x", iniread()) ; write in my FILE all the sections, inisectionread? o.O something like that
wend

run("@scriptDir & "\restartSciTE.au3") ;obvious what it does :P

maybe THAT is something that you can realise? :) *fingercrossing*

jawed

Edited by jawed
Link to comment
Share on other sites

i managed to do it :) so here is my solution:

first of all you need some preparation.

-create on your desktop one .txt file and rename it to "mycalltips.api" or something, just the ending has to be ".api". i call it "jawed.api"

navigate to: "C:Program Files (x86)AutoIt3SciTEapi" and copy your "jawed.api" in the folder you opened. so far so good. next step.

-navigate to: "C:Program Files (x86)AutoIt3SciTEProperties"

look for the file "au3.properties", open it with editor or notepad++ (or whatever you prefer)

now search for "# Autocomplete and call tip settings" its green highlited and after THAT line is one long line.

mine looked like "api.$(au3)=$(SciteDefaultHome)apiau3.api;$(SciteDefaultHome)apiau3.autoit3wrapper.api;$(SciteUserHome)au3.user.calltips.api"

NOW you have to ADD (important!) ";$(SciteDefaultHome)apijawed.api" (yes, with the " ;$ " at the beginning")

yeahh, preparations done :) so here's my au3 file

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         Jawedooo

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

#include <File.au3>
#include <Array.au3>
#RequireAdmin

$Fahrzeugklasse = InputBox("Fahrzeugklasse", "Bitte gib die Fahrzeugklasse ein" & @CRLF & "(Beachte Rechtschreibung und Groß- und Kleinschreibung)")
Sleep(200)

If FileExists(@ScriptDir & "\allgemein\jawed.api") Then FileDelete(@ScriptDir & "\allgemein\jawed.api")
FileWrite(@ScriptDir & "\allgemein\jawed.api", "")

$sPath = @ScriptDir & "\" & $Fahrzeugklasse
If @error Then MsgBox(0, "", "1")
$aFiles = _FileListToArray($sPath,"*.ini",1) ; Txt Dateien in ein Array lesen

If @error Then MsgBox(16,"Error","No files found")

for $j = 1 to $afiles[0] Step 1
    $var = IniReadSectionNames(@ScriptDir & "\" & $Fahrzeugklasse & "\" & $aFiles[$j])
    MsgBox(0, $j, @ScriptDir & "\" & $Fahrzeugklasse & "\" & $aFiles[$j])
    If @error Then
        MsgBox(4096, "", "Es ist ein Fehler aufgetreten. Wahrscheinlich keine INI Datei vorhanden.")
    Else
        For $i = 1 To $var[0]
            $blubb = StringSplit($var[$i], "_")
            If $blubb[1] = "lbl" Then ContinueLoop
            $blubb = StringReplace($blubb[2], " ", "_")
            FileWrite(@ScriptDir & "\allgemein\jawed.api", $blubb & @CRLF)
        Next
    EndIf
Next
Sleep(200)

If FileExists(@ProgramFilesDir & "\AutoIt3\SciTE\api\jawed.api") Then   FileDelete(@ProgramFilesDir & "\AutoIt3\SciTE\api\jawed.api")
FileMove(@ScriptDir & "\allgemein\jawed.api", @ProgramFilesDir & "\AutoIt3\SciTE\api\jawed.api", 1)
Sleep(200)

ProcessClose("SciTE.exe")
Sleep(200)
Run(@ProgramFilesDir & "\AutoIt3\SciTE\SciTE.exe")
Sleep(200)
MsgBox(0, "Befehle importieren", "Fertig `;..;´")

you just have to change some lines for your own need :)

Link to comment
Share on other sites

  • Developers

You do not want to edit au3.properties as that is replaced with each installation/upgrade of SciTE4AutoIt3 with the installer.

Use the linked au3.user.calltips.api to make any user modifications.

Jos

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

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...