Jump to content

INI help with read in multi places


Recommended Posts

Ive looked at iniread, but I am not sure how I would get it to work to read the contents of the ini in the 3 areas below.

Any help would be greatly appreciated thank you.

#region ---Au3Recorder generated code Start ---
Opt("WinWaitDelay",100)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)

_WinWaitActivate("IPO : INISETTING1 - Microsoft Internet Explorer","")
MouseClick("left",31,158,1)
_WinWaitActivate("IPO -- Web Page Dialog","")
Sleep ( 5000 )
Send("INISETTING2{TAB}")
Sleep ( 5000 )
Send("INISETTING3{TAB}{TAB}{TAB}{TAB}{TAB}")
Sleep ( 5000 )
Send("{enter}")
Sleep ( 5000 )
Send ("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}")
Sleep ( 5000 )
Send ("{space}")
Sleep ( 2000 ) 
Send ("{TAB}{TAB}{TAB}")
Sleep ( 2000 )
Send ("w")
Sleep ( 1000 )
Send ("{TAB}")
Sleep ( 1000 )
Send ("{enter}")
Sleep ( 5000 )
Send ("{SHIFTDOWN}{tab}{SHIFTUP}")
Sleep ( 500 )
Send ("m")
Sleep ( 500 )
Send ("{tab}")
Sleep ( 100 )
Send ("test")
Sleep ( 100 )
Send ("{tab}")
Sleep ( 100 )
Send ("test")
Sleep ( 100 )
Send ("{tab}{tab}")
Sleep ( 100 )
Send ("11112222")
Sleep ( 100 )
Send ("{tab}")
Send ("Job")
Sleep ( 100 )
Send ("{tab}")
Sleep ( 100 )
Send ("street")
Sleep ( 100 )
Send ("{tab}")
Sleep ( 100 )
Send ("30000{tab}")
Sleep ( 2000 )
Send ("{tab}{tab}")
Sleep ( 100 )
Send ("123456789{tab}")
Sleep ( 100 )
Send ("123456789{tab}")
Sleep ( 100 )
Send ("{tab}{tab}{tab}{tab}{tab}{enter}")
Sleep ( 5000 )
Send ("{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}")
Sleep ( 5000 )
Send ("{enter}")
Sleep ( 2000 )
Send  ("{space}")
Sleep ( 500 )
Send ("{tab}")
Sleep ( 500 )
Send  ("{space}")
Sleep ( 500 )
Send ("{tab}")
Sleep ( 500 )
Send  ("{space}")
Sleep ( 500 )
Send ("{tab}")
Sleep ( 500 )
Send  ("{space}")
Sleep ( 500 )
Send ("{tab}{RIGHT}")
Sleep ( 500 )
Send ("{tab}{tab}{tab}{tab}{tab}")
Sleep ( 2000 )
Send ("{enter}")
Sleep ( 5000 )
Send ("{RIGHT}")
Sleep ( 500 )
Send ("{tab}{tab}{tab}")
Sleep ( 2000 )
Send ("{enter}")
Sleep ( 2000 )
Send ("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}")
Sleep ( 2000 )
Send ("{enter}")
Sleep ( 5000 )
Send ("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}")
Sleep ( 5000 )
Send ("{enter}")
Sleep ( 5000 )
Send ("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}")
Sleep ( 2000 )
Send ("{enter}")
Sleep ( 2000 )
Send ("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}")
Sleep ( 1000 )
Send ("{DOWN}{DOWN}")
Sleep ( 1000 )
Send ("{tab}{tab}{tab}{tab}")
Sleep ( 3000 )
Send ("{enter}")
Sleep ( 5000 )
Send ("{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}")
Sleep ( 3000 )
Send ("{enter}")
Sleep ( 3000 )
Send ("{enter}")
Sleep ( 3000 )
Send ("{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}{tab}")
Sleep ( 6000 )
Send ("{enter}")
Sleep ( 3000 )
Send ("{tab}")
Sleep ( 500 )
Send ("{enter}")
Sleep ( 3000 )


#region --- Internal functions Au3Recorder Start ---
Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc
#endregion --- Internal functions Au3Recorder End ---

#endregion --- Au3Recorder generated code End ---
Edited by jbsoccerbrit
Link to comment
Share on other sites

  • Moderators

jbsoccerbrit,

The Ini* functions are designed to work directly with the ini file on disk - not as part of a web page dialog. You need to find the file in which the strings are saved and then use the Ini* functions on that file. :graduated:

If you want to interact directly with the web page dialog, look at the IE.au3 UDF - it should allow you to read (and change) the contents of the web page. :(

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

I'll try and explain further if it helps.

Basically I want the script to read the ini values so it can pass them onto the webpage in some cases. For example if I need a username in the place of INISETTING1 I can save it to the .ini file and then kick off the script so it just reads that value.

Later on however the web app requests 2 sets of 9 digit numbers and these are the main things that need to be inserted. Kinda like sending it to the webpage via a gui of sorts I guess but actually read from an ini.

Hopefully that makes sense.

Edited by jbsoccerbrit
Link to comment
Share on other sites

  • Moderators

jbsoccerbrit,

Basically I want the script to read the ini values

So what is the name of the ini file and what settings are you trying to read from it?

pass them onto the webpage

This is where the IE UDF will come in handy as it should enable you to do this directly without the need to Send several hundred {TAB} keys. :graduated:

What is the url of this page so we can look at its internal structure?

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

I just made something like temp.ini and placed it at the root of my c:\

_WinWaitActivate("IPO : "$var1 = IniRead("C:\temp.ini", "section1", "username", "NotFound")" - Microsoft Internet Explorer","")

MouseClick("left",31,158,1)

_WinWaitActivate("IPO -- Web Page Dialog","")

Sleep ( 5000 )

Send(""$var2 = IniRead("C:\temp.ini", "section2", "numbers1", "NotFound")"{TAB}")

Sleep ( 5000 )

Send(""$var3 = IniRead("C:\temp.ini", "section3", "numbers2", "NotFound")"{TAB}{TAB}{TAB}{TAB}{TAB}")

contents of the ini would be like

[section1]

username=namehere

[section2]

numbers1=123456789

[section3]

numbers2=123456789

The value of username doesnt actually have to be passed to the webpage, but section 2 and section 3's contents would have to be. As long as section 1 usersname matches the username of the web app already being used everything should work.

The webpage itself is an internal tool, so I cant actually give it out... sorry, but thank you for the help.

Edited by jbsoccerbrit
Link to comment
Share on other sites

  • Moderators

jbsoccerbrit,

Bit of problem with syntax there! :D

To read your ini and use the values you need something like this: :graduated:

; read the user name
$sUserName = IniRead("C:\temp.ini", "section1", "username", "NotFound")
; make sure we found one!
If $sUsername <> "NotFound" Then
    ; read the numbers
    $sNumbers1 = IniRead("C:\temp.ini", "section2", "numbers1", "NotFound")
    $sNumbers2 = IniRead("C:\temp.ini", "section3", "numbers2", "NotFound")
    ; now put these into the web page
    _WinWaitActivate("IPO : " & $sUserName & " - Microsoft Internet Explorer","")
    MouseClick("left",31,158,1)
    _WinWaitActivate("IPO -- Web Page Dialog","")
    Sleep ( 5000 )
    Send($sNumbers1 & "{TAB}")
    Sleep ( 5000 )
    Send($sNumbers2 & "{TAB}{TAB}{TAB}{TAB}{TAB}")
Else
    ; Some thing else if the username was not found
EndIf

You do not need separate sections for each value, but it does not hurt. :D

I hope that helps. :(

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

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