Jump to content

Sending text to Notepad


Recommended Posts

HI Guys

I am trying to send text to notepad, for the most it works fine however there are three places where the text to be sent must come from my GUI. I originaly I wrote this script in Autoit 2 and to get the text I used a message box and used %IPMessage%.

How do I achive the same out come in v3

My v2 Script:

InputBox, IPMessage, IP-Mapping, Please - Enter the IP address where the\n1FCUserPassword.exe is located!\n\nExample 192.168.xx.9\n\n O N L Y T H E I P A D D R E S S

SplashTextOn, 400, 200, Script writher, P L E A S E D O N O T T O U C H T H E K E Y B O A R D\n O R M O U S E D U R I N G T H E S C R I P T .

Send, %IPMessage%\\\\Programs{

Send, ENTER}{ENTER}

Please see below script, this is as far as I have got.

#include <GuiConstants.au3>
#include <Array.au3>
Opt("GUIOnEventMode", 1)

; GUI
GuiCreate("FCPassword Tool Writer", 400, 260)
GuiSetIcon("Icons\AppIcon.ico")

; INPUT
$IPAddress = GuiCtrlCreateInput("", 120, 120, 130, 20)
GuiCtrlCreateLabel("IP-Address:", 5, 122)
$FidUser = GuiCtrlCreateInput("", 120, 140, 130, 20)
GuiCtrlCreateLabel("Fudelio User Name:", 5, 142)
$FidPassword = GuiCtrlCreateInput("", 120, 160, 130, 20)
GuiCtrlCreateLabel("Fidelio Password:", 5, 162)

; BUTTON
$button = GUICtrlCreateButton("Create Script", 30, 215, 340, 40, "")
    GUICtrlSetOnEvent($button, "button")
    GUISetState(@SW_SHOW)
    
   
; GUI MESSAGE LOOP
GUISetState()
While 1
WEnd

Func button()
    Run ("Notepad.exe")

WinWaitActive("Untitled - Notepad")

;Set Key Delay
    AutoItSetOption ( "SendKeyDelay", 5 )

    Send ( '; Script Function:{ENTER}' )
    Send ( ';         To set password for Fidelio module.{ENTER}' )
    Send ( ';{ENTER 2}' )

    Send ( 'HideAutoItWin, On{ENTER}' )
    Send ( '; Start of script proper{ENTER}' )
    Send ( '; Fidelio Password Change{ENTER}' )
    Send ( '; =============={ENTER 3}' )
    Send ( 'MsgBox, 33, Fidelio Module Update Utility, ============== We need update your 

fidelio module ===============\n\nY O U R   F I D E L I O   W I L L N O T   W O R K\nU N L 

E S S   Y O U   H A V E R U N   T H I S\nM O D U L E    A T L E A S T   O N C 

E\n\nPlease click OK and wait for the utility to finish.\n\nIf you have run this utility once 

already click CANCEL\n\n\nThank you for your cooperation{ENTER}' )
    Send ( 'IfMsgBox, CANCEL, Goto, IWantToQuit{ENTER 2}' )
    Send ( '; Begin Splash{ENTER}' )
    Send ( 'SplashTextOn, 400, 200, Fidelio update Utility, P L E A S E  D O  N O T  T O U C H  

T H E  K E Y B O A R D\n  O R  M O U S E  D U R I N G  T H E  S C R I P T .{ENTER}' )
    Send ( 'Sleep, 5000{ENTER 2}' )
    Send ( '; Info{ENTER}' )
    Send ( 'SplashTextOn, 400, 200, Fidelio update Utility, P L E A S E  D O  N O T  T O U C H  

T H E  K E Y B O A R D\n  O R  M O U S E  D U R I N G  T H E  S C R I P T . \n\nWe are now 

Mapping the necessary drive.{ENTER}' )
    Send ( 'Sleep, 100{ENTER 2}' )
    Send ( '; Run Command{ENTER}' )
    Send ( 'Run, cmd.exe{ENTER 2}' )
    Send ( 'send, net use /del b:{' )
    Send ( 'ENTER}{ENTER}' )
    Send ( 'send, net use b: \\' )
    SplashOff ( )
    $IPMessage = $IPAddress

   ;SplashTextOn ( 'Script writher', 'P L E A S E  D O  N O T  T O U C H  T H E  K E Y B O A R 

D' & @LF & '  O R  M O U S E  D U R I N G  T H E  S C R I P T .', 400, 200 )

    Send ( $IPMessage & '\\Programs{' )
    Send ( 'ENTER}{ENTER}' )
    Send ( 'send, exit{' )
    Send ( 'ENTER}{ENTER}' )
    Send ( 'Sleep, 1000{ENTER 2}' )
    Send ( '; Info{ENTER}' )
    Send ( 'SplashTextOn, 400, 200, Fidelio update Utility, P L E A S E  D O  N O T  T O U C H  

T H E  K E Y B O A R D\n  O R  M O U S E  D U R I N G  T H E  S C R I P T .{ENTER}' )
    Send ( 'Sleep, 100{ENTER}' )

; Finished!

EndFunc

Thanks in advance for your help.

Craig

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