Jump to content

Prompt to Call Phone Number


 Share

Recommended Posts

Hello,

We have software installers at our company who need to install software on remote computers. Sometimes the end user at the remote computer will log on and interrupt the install process. Most of the time our software installers can regain control of the remote computer to finish installing software but in some instances the end user does not understand that they are interrupting anything and needs to be told verbally to stay off of the machine until our software installers are finished with their install. I have attempted to make an easy way for our software installers to make a custom spashscreen that they can run on the remote computer that will dispay a phone number for the end user to call but I have run into a problem.

I want the software installer to run my program and enter their phone number after being prompted and press OK. Then my program will create another little program with the username of the software installer (username.exe). The username.exe program will display a message on the screen with the phone number to call.

The username.exe program gets created as expected but when I try to run it I get an AutoIT error that says: Line -1: Error parsing function call. The same program will compile and run if I go to the command prompt and manually type "aut2exe.exe /in call.me.au3 /out username.exe". Can anyone help me figure out what is wrong?

;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x/NT/2000/2003/XP/Vista/Windows 7
; Author:         RobH (rob.h@companyname.com)
;
; Program Function: Create a program titled username.exe that displays a splashscreen with user phone number.
;
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#AutoIt3Wrapper_Icon=RH.ico

;Variables for Aut2Exe.exe /in call.me.au3 /out %username%.exe
$uname = EnvGet("username")
$AutoItPath = "Aut2Exe.exe "
$InputFile = "/in call.me.au3 "
$OutputFile = "/out " & $uname & ".exe"
$phonenumber = InputBox("Phone #", "Type In Your 10 digit Phone Number (No Dashes):  ", "")
;$hGUI = GUICreate("Type In Your 10 digit Phone Number (No Dashes):  ", 275, 50)
;$phonenumber = GUICtrlCreateInput("1234568790", 10, 10, 250, 20, $ES_NUMBER)
;GUISetState()

If $phonenumber = 0 Then
    Exit
    Else    
    Local $sFormattedphonenumber = StringRegExpReplace($phonenumber, "(.{3}){1}(...{1})", "\1-\2-\3")
    ;MsgBox(0, "", $sFormattedphonenumber)

;Enter necessary information into Call.Me.au3 file.
$file = FileOpen("Call.Me.au3", 2)
; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
$DoubleReturn = " & @LF & @LF & ""Please call """
$TheEnd = """."", 480, 250, -1, -1, 4, "", 22)"""
Filewrite($file, ";" & @CRLF)
Filewrite($file, "; AutoIt Version: 3.0" & @CRLF)
Filewrite($file, "; Language:       English" & @CRLF)
Filewrite($file, "; Platform:       Win9x/NT/2000/2003/XP/Vista/Windows 7" & @CRLF)
Filewrite($file, "; Author:         RobH (rob.h@companyname.com)" & @CRLF)
Filewrite($file, ";" & @CRLF)
Filewrite($file, "; Program Function: Display a splashscreen prompting the user to call a phone number." & @CRLF)
FileWrite($file, "#NoTrayIcon" & @CRLF)
FileWrite($file, "SplashTextOn(""IT Patient Care Applications."", ""IT Patient Care Applications team will need to take control of this machine to install / update software.""" & $DoubleReturn & $sFormattedphonenumber & $TheEnd);
FileWrite($file, & @CRLF "WinWaitActive(""Wait Forever"")" & @CRLF)
FileClose($file)
    Sleep(2000)
    Run($AutoItPath & $InputFile & $OutputFile)
    ;MsgBox(8192, "Output:", $AutoItPath & $InputFile & $OutputFile)
EndIf
Edited by RobertH
Link to comment
Share on other sites

For debugging, it will be easier to make a template script, which you read in and write out to the new program. This way you can look at the code in Scite and see the markups.

You would want to 'tag' the replacement with something like this:

<<PHONENUMBERGOESHERE>>
And as you run through the lines, use StringInStr to find and then StringRegexReplace to modify it when it's found.

Embedding the code in your main program is a cool idea, and good for obfuscation, but it is a nightmare to maintain.

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

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