Jump to content

Recommended Posts

Posted

Hello,

I have an idea for my script but having trouble to create it.

So, how should it work?
For example, I have a script with GUI where users after execution get a droplist to select a company, for example: from 10 random companies, and the user selects one of them.
Every single company cointans address with minimum 3 words inside, 

for example $company1 = "Address str." & "ApartNr" & "Postcode"
                       $company2 = "Address str." & "ApartNr" & "Postcode"


and more 8 others. When the user selects $company1 in droplist, the script should seperate these 3 words and paste to 3 different fields in PDF form file. Like Address.str {TAB} ApartNr {TAB} PostCode.

Is this possible to do with 10 random companies together in list? I was looking in forum something similar but didn't find anything.

 

  • Moderators
Posted (edited)

@diff you are always going to get more help if you provide some code, so people can see what you're seeing. It also helps you with the logical progression of your code. Start with the GUI, and populating the drop-down like you want it, before moving on to passing the values to a PDF. If you start from the basics, you will understand it a lot better than someone simply coding it for you. Here is a GUI template you can begin with:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

GUICreate("Test", 300, 300)
GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

GUIDelete()

Start by adding your drop-down (GUICtrlCreateCombo) and populating it. The example in the help file will help you immensely in this regard. Once you have this, port back here; we can then help you with next steps.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted
On 5/1/2020 at 2:59 AM, JLogan3o13 said:

@diff you are always going to get more help if you provide some code, so people can see what you're seeing. It also helps you with the logical progression of your code. Start with the GUI, and populating the drop-down like you want it, before moving on to passing the values to a PDF. If you start from the basics, you will understand it a lot better than someone simply coding it for you. Here is a GUI template you can begin with:

Start by adding your drop-down (GUICtrlCreateCombo) and populating it. The example in the help file will help you immensely in this regard. Once you have this, port back here; we can then help you with next steps.

 

Hi,

 

sorry for a late answer, I have started it but stuck.

 

here is my code:

#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <ButtonConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 251, 437, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 40, 24, 145, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("Select", 152, 56, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $ini = 'companies.ini'
Global $sections = IniReadSectionNames($ini)
If (Not @Error) Then GUICtrlSetData($Combo1, _ArraytoString($sections, "|", 1), $sections[1])
;~ For $a = 1 To UBound($sections) - 1
;~  ConsoleWrite($sections[$a] & @CRLF)
;~ Next
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            $test = _ArrayToString(IniReadSection($ini, guictrlread ($Combo1)),"=",1)
            MsgBox($MB_SYSTEMMODAL, "", $test)
    EndSwitch
WEnd

 

Here I receive dropdown list with my companies and when I click Select (for testing only with MsgBox trying) I see everything I wrote in my .ini file after section.

My ini looks like this:

[Company1]
Address=Kdkeooe st. 22-11
Country=India
City=Mumbai

[Company2]
Address=Koeeeee 100st.
Country=America
City=New York

So after clicked Select I see full string (and its not what I wanted to see):

Address=Koeeeee 100st.
Country=America
City=New York

But I need to fill my PDF and the result after selection should show somehow separetely address, country and city to fill my 3 fields in PDF.

 

I mean If I selected in droplist Company1 then it should somehow save 3 seperate fields to variables? from Section Company1 which is address, country and city and then I want to automate PDF filler to write these results seperately to every field. I hope you understand what I meant.

 

PDF filler I already created but it works only with variables I coded to paste from code to PDF, here I want to copy 3 fields from droplist section and paste them seperately in to PDF fields.

Posted

Do you mean

#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <ButtonConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 251, 137, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 40, 24, 145, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("Select", 152, 56, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $ini = 'companies.ini'
Global $sections = IniReadSectionNames($ini)
If IsArray($sections) Then
For $a = 1 To UBound($sections) - 1
    GUICtrlSetData($Combo1, $sections[$a])
Next
EndIf

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $Address = IniRead($ini, guictrlread($Combo1), 'Address', '')
            $Country = IniRead($ini, guictrlread($Combo1), 'Country', '')
            $City = IniRead($ini, guictrlread($Combo1), 'City', '')
            ConsoleWrite('Address '&$Address&@TAB&' Country '&$Country&@TAB&' City '&$City&@CRLF)
            MsgBox(64 + 262144, guictrlread($Combo1), 'Address '&$Address&@TAB&' Country '&$Country&@TAB&' City '&$City&@CRLF)
    EndSwitch
WEnd

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted
3 hours ago, careca said:

Do you mean

****

From the code its looks like what I need, but dropdown list shows nothing to select, I'm looking at the code and seems like everything is good but why nothing to select?

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...