Jump to content

Can anyone help me with this ?


AMDONLINE
 Share

Recommended Posts

Hi to everyone from a new Forum member, I have downloaded the software and finding difficulty with it as I am new to programming in general and I am quite puzzled trying to create the following !

What I am trying to do is to create a script which I can use in AutoPalay Media Studio whereby the user inserts info ( name/address etc) into text boxes. This info is then saved and transfers to a Microsoft Word document and the text is displayed as typed when the Word doc is opened.

If anyone can help this would be appreciated- perhaps an example script is availavle but I could not find one in the Forum

Kind Regards

Andy

Link to comment
Share on other sites

When you refer to Autoplay, its a program I am using to create my own windows based program within which a user inputs project detail text in text boxes being the Client name/address etc. This info then appears on a word doc when the selected command button is clicked to open the word doc.

I hope I have explained this better to you.

Many Thanks

Andy

Link to comment
Share on other sites

My question is: do you really need AutoPlay? I am just wondering if you have a specific purpose for using that program or if you think you need that program because you don't realize that AutoIt can do everything you want without AutoPlay.

I ask this because I don't want to waste time pointing you in one direction and later finding out your needs were different from what I assumed.

#include <ByteMe.au3>

Link to comment
Share on other sites

Here's something simple to start with. See if this is anywhere near what you are looking for.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
 
$Form1 = GUICreate("MyGui", 270, 178)
$Input1 = GUICtrlCreateInput("", 16, 26, 121, 21)
$Label1 = GUICtrlCreateLabel("Client Name", 16, 8, 61, 17)
$Label2 = GUICtrlCreateLabel("Address", 16, 66, 42, 17)
$Input2 = GUICtrlCreateInput("", 16, 80, 121, 21)
$Label3 = GUICtrlCreateLabel("Etc", 16, 122, 20, 17)
$Input3 = GUICtrlCreateInput("", 16, 136, 121, 21)
$Button1 = GUICtrlCreateButton("Write To Word", 152, 64, 99, 57)
GUISetState(@SW_SHOW)
 
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ShellExecute("winword")
            WinWaitActive("Microsoft Word")
            Opt("WinTitleMatchMode", 2)
            Sleep(250)
            $clientName = GUICtrlRead($Input1)
            $address = GUICtrlRead($Input2)
            $etc = GUICtrlRead($Input3)
            Send($clientName & @CR & $address & @CR & $etc)
    EndSwitch
WEnd

#include <ByteMe.au3>

Link to comment
Share on other sites

Thanks for that Sleepydvdr, thats pretty much what I am after

If you could just amend slightly that would be great

Client name

No./Street

Town

County

Postcode.

The rest is fine.

I would do myself and have tried to do so but the layout numbers( 15,136 etc are causing me issues and I need to try and learn this soon !

Thanks

Andy

Link to comment
Share on other sites

If you are having trouble with finding Koda, here is the website:

http://koda.darkhost.ru/page.php?id=download

And here is a little video I made to show you how to make what you want in Koda:

http://www.digifract.com/AutoItTrainingVideo/01/HowToUseKoda.html

#include <ByteMe.au3>

Link to comment
Share on other sites

Hi, I have compiled my first script but something is not quite right.

Cant spot it my self and was hoping one of your more experienced users could take a look at the script below and advise :

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=form1.kxf

$Form1_1 = GUICreate("Form1", 615, 631, 192, 124)

GUICtrlCreateInput("", 224, 32, 257, 24)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

GUICtrlCreateInput("", 224, 88, 257, 24)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

$Label1 = GUICtrlCreateLabel("Client Name", 128, 34, 84, 20)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

GUICtrlCreateInput("", 224, 144, 257, 24)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

$Label2 = GUICtrlCreateLabel("Address Line 1", 121, 90, 91, 20)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

$Label3 = GUICtrlCreateLabel("Address Line 2", 121, 146, 91, 20)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

GUICtrlCreateInput("", 224, 200, 257, 24)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

GUICtrlCreateInput("", 224, 256, 257, 24)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

$Label4 = GUICtrlCreateLabel("City", 185, 202, 27, 20)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

$Label5 = GUICtrlCreateLabel("County", 167, 258, 45, 20)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

$Input6 = GUICtrlCreateInput("", 224, 312, 129, 24)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

$Label6 = GUICtrlCreateLabel("Postcode", 153, 314, 59, 20)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

$Label7 = GUICtrlCreateLabel("Project Reference", 105, 361, 107, 20)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

$Input1 = GUICtrlCreateInput("", 224, 359, 313, 24)

GUICtrlSetFont(-1, 10, 400, 0, "Arial")

$Button1 = GUICtrlCreateButton("Copy to Word", 424, 464, 113, 65)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

$ClientName = GUICtrlRead($Input1)

$AddressLine1 = GUICtrlRead($Input2)

$AddressLine2 = GUICtrlRead($Input3)

$City = GUICtrlRead($Input4)

$County = GUICtrlRead($Input5)

$Postcode = GUICtrlRead($Input6)

$ProjectReference = GUICtrlRead($Input7)

ShellExecute("winword")

WinWaitActive("Microsoft Word")

Opt("WinTitleMatchMode" , 2)

Sleep(250)

Send($ClientName & @CR & $AddressLine1 & @CR & $AddressLine2 & @CR & $City & @CR & $County & @CR & $Postcode & @CR & $ProjectReference)

EndSwitch

WEnd

Any help again would be much appreciated

Andy

Link to comment
Share on other sites

AMDONLINE, in the future a better (and much more like) way of posting long code is to put it into a code box. Theres a button with the autoit symbol on the editor tool bar that you can use or just put your code between the autoit tags. :graduated:

code

Give me a min while I look at your code.

edit: wtf that didnt work

Edited by Beege
Link to comment
Share on other sites

Your variables are not declared for your input boxes.

$Form1_1 = GUICreate("Form1", 615, 631, 192, 124)
GUICtrlCreateInput("", 224, 32, 257, 24); <<<< Nothing declared
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlCreateInput("", 224, 88, 257, 24)

just go back and add them in. easy fix

$Form1_1 = GUICreate("Form1", 615, 631, 192, 124)
$input1 = GUICtrlCreateInput("", 224, 32, 257, 24);
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlCreateInput("", 224, 88, 257, 24)
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...