Jump to content

GUICtrlCreateInput wont return strings


Recommended Posts

hey autoit peoples,

this is the first GUI ive made. it take customer info, then puts it into an indesign template then prints an invoice. i made the GUI because i thought it would look prettier than multiple input boxes. the problem is GUICtrlCreateInput is returning single digits rather than "company name" or "customer name" and i dont quite understand why. i know nobody has the indesign template to test, but thats OK because i know that part works.

so for instance:

$companyin = GUICtrlCreateInput("", 10, 30, 220, 20)
msgbox (1, "", $companyin)

returns 3. ??????

if someone could take a look and let me know id be great full. this is the link to where i originally got the idea for a GUI.

additionally, ive never tried to return a whole array from a function, did i do that right?

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

Func GUIforinvoice()
$gui = GUICreate("Create New Invoice", 747, 300)

$companyin = GUICtrlCreateInput("", 10, 30, 220, 20);FIRST
$company = GUICtrlCreateLabel("Company", 10, 10, 136, 15)

$namein = GUICtrlCreateInput("", 240, 30, 220, 20);SECOND
$name = GUICtrlCreateLabel("Name", 240, 10, 136, 20)

$streetaddressin = GUICtrlCreateInput("", 470, 30, 220, 20);THIRD
$streetaddress = GUICtrlCreateLabel("Street address", 470, 10, 136, 20)

$citystatezipin = GUICtrlCreateInput("", 10, 80, 220, 20);FIRST
$citystatezip = GUICtrlCreateLabel("City, State, ZIP", 10, 60, 136, 20)

$phone1in = GUICtrlCreateInput("", 240, 80, 220, 20);SECOND
$phone1 = GUICtrlCreateLabel("Work Phone", 240, 60, 136, 20)

$phone2in = GUICtrlCreateInput("", 470, 80, 220, 20);THIRD
$phone2 = GUICtrlCreateLabel("Personal Phone", 470, 60, 136, 20)

$faxin = GUICtrlCreateInput("", 10, 130, 220, 20);FIRST
$fax = GUICtrlCreateLabel("Fax", 10, 110, 136, 20)

$emailin = GUICtrlCreateInput("", 240, 130, 220, 20);SECOND
$email = GUICtrlCreateLabel("Email", 240, 110, 136, 20)

$recievedin = GUICtrlCreateInput(@MON & " - " & @MDAY &" - "& @YEAR, 470, 130, 220, 20);THIRD
$recieved = GUICtrlCreateLabel("Recieved Date", 470, 110, 136, 20)

$duein = GUICtrlCreateInput("", 10, 180, 220, 20);FIRST
$due = GUICtrlCreateLabel("Due Date", 10, 160, 136, 20)

$invin = GUICtrlCreateInput("", 240, 180, 220, 20);SECOND
$inv = GUICtrlCreateLabel("Invoice # (LEAVE DEFAULT)", 240, 160, 200, 20)

$poin = GUICtrlCreateInput("", 470, 180, 220, 20);THIRD
$po = GUICtrlCreateLabel("Customer PO#", 470, 160, 136, 20)

$chartstringin = GUICtrlCreateInput("",10, 230, 220, 20);FIRST
$chartstring = GUICtrlCreateLabel("Chartstring", 10, 210, 136, 20)

$ccaccountin = GUICtrlCreateInput("", 240, 230, 220, 20);SECOND
$ccaccount = GUICtrlCreateLabel("CC Account Number", 240, 210, 136, 20)

$tbyin = GUICtrlCreateInput("", 470, 230, 220, 20)
$tby = GUICtrlCreateLabel("Taken By", 470, 210, 136, 20)


$ok=GUICtrlCreateButton("CREATE",8.5,260,730,30)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $ok

ExitLoop
EndSelect
WEnd

msgbox(1, "", $companyin)


local $return[15]
$return[0] = $companyin
$return[1] = $namein
$return[2] = $streetaddressin
$return[3] = $citystatezipin
$return[4] = $phone1in
$return[5] = $phone2in
$return[6] = $faxin
$return[7] = $emailin
$return[8] = $recievedin
$return[9] = $duein
$return[10] = $invin
$return[11] = $poin
$return[12] = $chartstringin
$return[13] = $ccaccountin
$return[14] = $tbyin

return $return

msgbox(1, "", $companyin)



endfunc
local $invoiceinfo[15]
$invoiceinfo = GUIforinvoice()

msgbox(1, "", $invoiceinfo[1])
ShellExecute("C:\Program Files (x86)\Adobe\Adobe InDesign CS5.5\InDesign.exe")
winwaitactive ("[CLASS:indesign]")
shellexecute ( "\\Bserver\dtp\invoice project.indd")
winwaitactive("invoice project.indd @ 125%")
sleep (5)
send ("^f")
winwaitactive ("[CLASS:InDesign_Window:5660125]")
sleep(500)
func findandreplace($find, $replace)
send("!f")
send($find)
send ("!c")
send($replace)
send("!n")
send("!h")
sleep(500)
EndFunc
findandreplace("<<company>>", $invoiceinfo[0])
findandreplace("<<company>>", $invoiceinfo[1])
findandreplace("<<company>>", $invoiceinfo[2])
findandreplace("<<company>>", $invoiceinfo[3])
findandreplace("<<company>>", $invoiceinfo[4])
findandreplace("<<company>>", $invoiceinfo[5])
findandreplace($find, $invoiceinfo[6])
findandreplace($find, $invoiceinfo[7])
findandreplace($find, $invoiceinfo[8])
findandreplace($find, $invoiceinfo[9])
findandreplace($find, $invoiceinfo[10])
findandreplace($find, $invoiceinfo[11])
findandreplace($find, $invoiceinfo[12])
findandreplace($find, $invoiceinfo[13])
findandreplace($find, $invoiceinfo[14])
<--a good way to start you day
Link to comment
Share on other sites

Look at the function GUICtrlRead in the help file, the return from the GUICtrlCreate... functions is the control ID, not the contents of the control.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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