Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
RykerS
- Newbie
- Posts: 4
- Joined: Mon Jan 02, 2012 6:07 pm
Post
by RykerS » Mon Jan 02, 2012 6:47 pm
Hello,
I'm trying to design a script and I'm having a few issues, Understanding how I can do this. I have been searching the forums and trying to find the method by reading the manual for quite a few hours now.
This is what I'm trying to get the script to do.
Have a dialogue pop-up and ask user to type something in. Example Fred.
User clicks okay.
Then, the script would continue. By taking what the user typed in and sending the text to the active application. Example Notepad.
If anyone has an example script. Or can point me in the right direction, to understand how I could achieve this. I would be truly grateful.
Also, if this post is not in the correct area of the forum, sorry in advance.
Thanks,

Ryker S.
-
PepsiHog
- Automation Wizard
- Posts: 517
- Joined: Wed Apr 08, 2009 4:19 pm
- Location: Florida
Post
by PepsiHog » Tue Jan 03, 2012 8:22 am
Hello RykerS
Here is a sample dialog. There are some commands that may be helpful that I have rem'd out. There are notes about what they do. You can read about them in the help.
You did not provide the version number of MS you are running. This is built using version 12. As is, without unremming, this macro assumes notepad is already running. And that it has no title. (Untitled - Notepad)
I hope this will be helpful.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 251
Top = 104
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 146
ClientWidth = 439
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 48
Top = 32
Width = 115
Height = 16
Caption = 'Enter Some Text'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object Edit1: TEdit
Left = 47
Top = 49
Width = 322
Height = 21
TabOrder = 0
end
object MSButton1: tMSButton
Left = 216
Top = 96
Width = 75
Height = 25
Caption = 'OK'
DoubleBuffered = True
ModalResult = 1
ParentDoubleBuffered = False
TabOrder = 1
DoBrowse = False
BrowseStyle = fbOpen
end
object MSButton2: tMSButton
Left = 296
Top = 96
Width = 75
Height = 25
Caption = 'Cancel'
DoubleBuffered = True
ModalResult = 2
ParentDoubleBuffered = False
TabOrder = 2
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
Show>Dialog1,r
Label>Start
if>r=1,DoNotepad
if>r=2,DoExit
Goto>Start
srt>DoNotepad
// This will run notepad.exe from the Windows directory
//RunProgram>%Win_Dir%\Notepad.exe
//WaitWindowOpen>Untitled*
// This will show a list of all windows open (next 2 lines)
//GetWindowList>wl
//mdl>%wl%
// This will get the handle of a window that is open
//GetWindowHandle>Untitled*,NpHan
// Make the notepad window the foreground window. (assumes a no-name notepad)
SetFocus>Untitled*
// Get the text entered in the dialog
GetDialogProperty>Dialog1,Edit1,Text,Entered
// Send the text to the notepad
SendText>%Entered%
// set r to 2 so program exits (or you could just type exit instead)
let>r=2
END>DoNotepad
srt>DoExit
exit
END>DoExit
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
-
RykerS
- Newbie
- Posts: 4
- Joined: Mon Jan 02, 2012 6:07 pm
Post
by RykerS » Thu Jan 05, 2012 8:18 pm
Hey PepsiHog,
Your script works like a charm, thank you for the fast reply. It also is helping me understand how to do what I was requesting, for future reference.
Thanks Alot,
Ryker S.