Page 1 of 1 1
Topic Options
#40311 - 2003-05-16 03:08 PM SendMessage
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Hi Guys -

I think I've woken up now [Smile]

I need a few things adding to my script but dont know where to look yet. I have done a search but maybe looking in the wrong place.
Basically I need to be able to put something in where a administrator would enter the $Pcname, if the put a * in it would go to every PC (my Audit dept would have me strung up!!) Is there a way I can stop this ? Also if the user doesnt put in anything for the $Pcname for it to keep asking for it until they either quit or enter a correct name ?

code:
CLS

Break On
?"Please enter the Pc you wish to send a message to"
?"e.g. OSYS10"
?
?

Gets $PCName

Break On
?"Please enter the Extension you wish the user to see"
?"e.g. 1340"
?
?

Gets $ext

Break On
?"Please enter the Subject the message Box is regarding"
?"e.g. Backup Tapes"
?
?

Gets $Subj

If @Serror ?"ERROR PLEASE CHECK PC IS ON-LINE AND DETAILS HAVE BEEN ENTERED CORRECTLEY!!"

EndIf

$Selection = SendMessage("$pcName", "Please Contact Your System Administrator on Extension $ext ASAP Regarding $subj")
If $Selection = 1
? "Ok Selected"
EndIf

_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#40312 - 2003-05-16 03:19 PM Re: SendMessage
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please take a look at the UDF Forum as there are already a couple of enter-text UDFs.
code:
while trim($text)='' or trim($text)='*'
? 'Enter text:'
gets $text
loop

_________________________
There are two types of vessels, submarines and targets.

Top
#40313 - 2003-05-16 03:36 PM Re: SendMessage
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Hi I have tried looking a searching but cant find any UDF's Im searching under "enter-text" "enter text" "Text" and I have tried looking though but I can see none...

HELP !!

Sorry to be a pain but im trying to search before I ask [Smile]

Can you point me in the right direction please

Aaron
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#40314 - 2003-05-16 03:45 PM Re: SendMessage
New Mexico Mark Offline
Hey THIS is FUN
****

Registered: 2002-01-03
Posts: 223
Loc: Columbia, SC
It looks like Jens gave you the code you need, even though it is not a UDF. You might not benefit much from UDF'ing this anyway.

NMM

Top
#40315 - 2003-05-16 03:47 PM Re: SendMessage
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If you are getting skunked, try changing the bait. A search of the two words send message revealed this amongst others.

http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=1;t=004472#000005
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#40316 - 2003-05-16 04:41 PM Re: SendMessage
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Sorry Im still not getting why this isnt working ?
Its just looping not matter what I put in the PC Name bit? I read all the sections about WHILE...LOOP AND TRIM but i cant see where im going wrong, please help !!
code:
Break On
?"Please enter the Pc Name you wish to connect too"
?"e.g. OSYS10"
?
?

Gets $PcName

While Trim($Pcname)="" OR Trim($Pcname)="*"
? "Please Re-enter PcName "
Gets $PcName
Loop

Break On
?"Please enter the Extension you wish the user to see"
?"e.g. 1340"
?
?

Gets $ext

Break On
?"Please enter the Subject the message Box is regarding"
?"e.g. Backup Tapes"
?
?

Gets $Subj

$Selection = SendMessage("$pcName", "Please Contact Your System Administrator on Extension $ext ASAP Regarding $subj")

If $Selection = 1
? "Ok Selected"

EndIf








_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#40317 - 2003-05-16 04:49 PM Re: SendMessage
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Aaron

quote:
$Selection = SendMessage("$pcName", "Please Contact Your System Administrator on Extension $ext ASAP Regarding $subj")
If $Selection = 1
? "Ok Selected"
EndIf

Hmmm ... I think you are still on the wrong path !

Sendmessage() does send a message to a remote system / users, nothing less but also nothing more, just like net send [Wink]

You can't query the user action on this message ...

[ 16. May 2003, 16:51: Message edited by: Jochen ]
_________________________



Top
#40318 - 2003-05-16 04:55 PM Re: SendMessage
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Hi Jochen

The script works fine its the :
quote:

While Trim($Pcname)="" OR Trim($Pcname)="*" ? "Please Re-enter PcName " Gets $PcName Loop

Thats the problem. If I take it out it works fine but I need to stop whoever uses this to not send it to All PCs. I need to disable the "*" and I also need it to loop when a user doesnt add anything in...

Sorry to be a pain but this is growing me unwanted grey hairs [Smile] I've looked and looked through it but cant see why its not working its almost like its ignoring the $Pcname

Aaron
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#40319 - 2003-05-16 04:55 PM Re: SendMessage
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Here's another way of skinning this one...
$PCName=""
Do
"Enter PC Name or 'q' to quit: "
GetS $PCName
$PCName=Trim($PCName)
Select
Case $PCName=""
"You must enter something!"+@CRLF
Case $PCname="*"
"Cannot incur the auditors wrath!"+@CRLF
$PCName=""
Case $PCName="q"
"Ok, Bye"+@CRLF
Exit 0
EndSelect
Until $PCName

Top
#40320 - 2003-05-19 09:23 AM Re: SendMessage
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Guys

This was a nightmare (they always are....)
It turns out if said $Pcname="" Kix would think this meant anything put in would ="" Strange....Has anybody else had this ?
or is there a way around this ?

(My script is working fine now, thanks)

code:
 

Break On
?"Please enter the Pc Name you wish to connect too"
?"e.g. OSYS10"
?
?

Gets $PcName

If
$Pcname="*" Exit
EndIf

Break On
?"Please enter the Extension you wish the user to see"
?"e.g. 1340"
?
?

Gets $ext

Break On
?"Please enter the Subject the message Box is regarding"
?"e.g. Backup Tapes"
?
?

Gets $Subj

SendMessage ("$pcName", "Please Contact Your System Administrator on Extension $ext ASAP Regarding $subj")


Exit

_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#40321 - 2003-05-19 10:09 AM Re: SendMessage
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Aaron,

$pcname = "" ?`

that means someone hits the enter key without typing a name ...

That could be easily catched in conditions checking like (If you have a naming convention for Workstation names it could also be enhancened more, I assume here a length of 8 characters)


Break On

? "Please enter the Pc Name you wish to connect too"
? "e.g. OSYS10"?

at(4,5) Gets $PcName

If $Pcname="*"
Exit 1
EndIf

while not $pcname or len($pcname) <> 8
beep
at(4,5)" "
Gets $PcName
loop

?"Please enter the Extension you wish the user to see"
?"e.g. 1340"
?
?Gets $ext

"Please enter the Subject the message Box is regarding"
?"e.g. Backup Tapes"
?
?Gets $Subj

$_ = SendMessage ("$pcName", "Please Contact Your System Administrator on Extension $ext ASAP Regarding $subj")

Exit 1


(very raw sample, please don't use unadapted [Wink] )
_________________________



Top
#40322 - 2003-05-19 10:34 AM Re: SendMessage
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Cheers Jochen

I will give it a go and let U know

Aaron
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.072 seconds in which 0.034 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org