Jump to content
3Jake

Short User-Creation script for Oracle?

Recommended Posts

Hello Smart People!

I have a multi-column .CSV that I would like to draw information from, in order to populate (send) that info to some fields in an Oracle form.  This would be for account-creation in Oracle.

I have the basic script to navigate (tab) through the fields in the Oracle form, but I am SUPER-new to AutoIT and don’t quite see how to get the script to import and use variables from a .CSV

For example:

Quote

 

Ticket Number  Logon    Name                    Email

Tx12345                jsmith   John Smith          john.smith@anyco.com

Tx12346                ljones    Leo Jones            leo.jones@anyco.com

Tx12347                mblue   Mary Blue           mary.blue@anyco.com

 

My script just waits for the page to be active, then enters data and tabs between fields like this:

; Wait for the window to be active

WinWaitActive("Oracle is Cool - E-Business is the Best")

 

; User Name

 Send("jsmith")

 Send("{TAB}")

 

; Password

 Send("Password1")

 Send("{TAB}")

 Send("Password1")

 Send("{TAB}")

 

; Description

 Send("John Smith")

 Send("{TAB}")

(etc. etc. etc.…)

The winning solution would take one row at a time, feed it into fields on the Oracle form, save, and then start in on the next row

It looks like I’d need a combination of “FileReadToArray” ( or“FileReadLine”?) and “StringSplit” to loop through the values and set them to variables, which would then replace my current "hard-coded" values to be typed them into the form?

I found the following example in the “Help” snippets for stringsplit()… this seems like it’s in the ballpark but I’m having some trouble wrapping this around what I’ve put together, since each entry in the array would have multiple elements per line instead of just “Day”:

Func Example()
    Local $aDays = StringSplit("Mon,Tues,Wed,Thur,Fri,Sat,Sun", ",") ;Split the string of days using the delimiter "," and the default flag value.
    #cs
        The array returned will contain the following values:
        $aDays[1] = "Mon"
        $aDays[2] = "Tues"
        $aDays[3] = "Wed"
        ...
        $aDays[7] = "Sun"
    #ce

    For $i = 1 To $aDays[0] ; Loop through the array returned by StringSplit to display the individual values.
        MsgBox($MB_SYSTEMMODAL, "", "$aDays[" & $i & "] - " & $aDays[$i])
    Next
EndFunc   ;==>Example

This post also seems like a similar example, but I don’t need it to be so selective RE: one specific column:

https://www.autoitscript.com/forum/topic/166261-how-to-read-csv-specific-row-and-columns

Any advice would be appreciated!  Thanks for taking a minute to look!

 

Share this post


Link to post
Share on other sites

why would you not use SQL Developer for this? Oracle can already import Excel files. manipulating Oracle Forms is going to probably require you use UIAutomation UDFs in AutoIt.

https://www.thatjeffsmith.com/archive/2012/04/how-to-import-from-excel-to-oracle-with-sql-developer/

there are ADO and other database UDFs as well on this Forum

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

I haven't looked into using that resource yet; I'm aware that there are other options out there that may also bear fruit, but I was also looking to expand my understanding of AutoIT, and thought that this would be a good intro.

But thanks for the link, I can check that out as well.

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

  • Similar Content

    • By MadhaN
      Hi all,
      I have a csv file as below, I wand to find srno from csv and send corresponding ip and pass to commend cmd prompt. 
      Please guide me to create script .
      srno,name,ip,pass
      1,name1,ip1,pass1
      2,name2,ip2,pass2
       
       
       
       
    • By MrCheese
      hi all,
      reviewing the forum, this thread is applicable: 
       
       
      I wanted to know if there is now a better way to do this?
      In essence, I load a tab delimited txt file into an array (works well). I used tab, as some fields in the original csv contains commas.
      However, I needed autoit to manipulate this array, and output it as a csv.
      IF my array contains items with a comma, without double quotes around the field, then how best do I get a csv out of this?
      My current workaround is to filewritefromarray tab delimited, then open it in excel and save as a csv. I will need to check this to see how the address fields behave that contain a comma.
       
      Any thoughts would be appreciated.
       
    • By AndyFul
      The problem is related to executing the program (coded in AutoIt) with admin rights on Standard User Account (SUA). The program is initially started from the SUA as standard user, but after elevation, the program is actually running on Administrator type of account. Only the program GUI windows are displayed on the initial SUA. Administrator account, where the program is actually running, is determined by credentials written in the UAC prompt.
      How can such a program check from what account (SID of that account is required) it was started if several users are actually logged in the computer?
      It is rather easy to find out the SID of the current Administrator account where the elevated program is running, but it is harder to see backwards, because the program could be started initially from any actually logged SUA account.
      I am thinking about finding the handle of the displayed window on SUA and using this information to find out the SID of SUA that hosts that handle. 
      Thanks, for any suggestions.
    • By SOF-TECH
      Dear all,
      Can someone show  me how to en hance the below function to write in CSV  into column  and rows the input values ? 
      I am getting this result: 

      I would like the result to be as this 

      From A1:C1 is for headers
      From A2:C2 is for input Data
      Global Const $GUI_EVENT_CLOSE = -3 $sDataFilePath = @ScriptDir & "\Records.csv" #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Demo1: New Record", 580, 115) $Input1 = GUICtrlCreateInput("", 10, 30, 270, 21) $Input2 = GUICtrlCreateInput("", 300, 30, 270, 21) $Input3 = GUICtrlCreateInput("", 10, 80, 270, 21) $Label1 = GUICtrlCreateLabel("Name:", 10, 10, 35, 17) $Label2 = GUICtrlCreateLabel("ID:", 300, 10, 18, 17) $Label3 = GUICtrlCreateLabel("Phone No:", 10, 60, 55, 17) $Button1 = GUICtrlCreateButton("Save to CSV", 450, 70, 120, 30) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _ExportData() MsgBox(64, @ScriptName, "Record Saved.") EndSwitch WEnd Func _ExportData() If Not FileExists($sDataFilePath) Then FileWriteLine($sDataFilePath, "Name;ID;Phone No.;") EndIf For $i = $Input1 To $Input3 FileWrite($sDataFilePath, GUICtrlRead($i) & ";") Next FileWriteLine($sDataFilePath, "") EndFunc ;==>_ExportData May be Excel UDF has be to be added but I can manage that my self  
      Thank you in advance
    • By ShawnW
      I have a script that takes a large excel file, pulls out and reorganizes certain information I need, and spits out a trimmed down csv file which I uses to upload the information on my website. Some of this information contains characters with accents or em dashes. By default it would create a csv file in ANSI which I then uploaded but had to tell my website import system it was windows-1252 in order for it to look correct.
      This was all working fine except now I need to add in a non-breaking space and non-breaking hyphen into parts of my output. At first I tried using ChrW(0xA0) and ChrW(0x2011) as replacements. A quick test in the console looked correct, however opening the csv output in notepad++ showed the space correctly but a ? for the hyphen and the file was still encoded as ANSI. I tried to view it as UTF-8 instead but this just made the space appear as xAO and also other characters appeared that way like my em dashes appeared as x97 and another symbol as xA7 etc.
      If I instead do a convert to UTF-8 from notepad++ then those problems go away except the hyphen still displays as ?. I then noticed on the page I linked for the non-breaking hyphen it lists the UTF-8 hex as 0xE2 0x80 0x91 (e28091). I was unsure how to enter this in autoit but several things i tried all failed to get the hyphen inserted.
      I need a way to get both the space and hyphen added correctly as either ANSI or UTF-8, but if it is UTF-8 then I need a way to convert all of the other data I extracted from the excel file.
      I've included a test excel file with a single line and test script to create a csv demonstrating the problem.
      test.xlsx
      test.au3
×
×
  • Create New...