Jump to content

Trying to Code smth for my friend


 Share

Recommended Posts

Basically, my friend wants to play a trick on his mum who knows hardly anything about computers, or at least that's what he claims.

Anyway, I have just started programming and thought it would be a good test.

However, I ran into a problem just at the start.

For one thing I couldn't get it to close, and then I couldn't figure out how to get it to do extra actions.

Here is my current code:

GUICreate("Fake Anti Virus", 250, 100)
GUICtrlCreateLabel("Length Of time before program starts in Ms-1000ms=1 second, 60000=1 min", 50, 10, 100, 20, 0x0001)
$timer = GUICtrlCreateInput ( "Put Length of time here", -1, -1 )
$start = GUICtrlCreateButton("Go!", 75, 35, 50, 30)
$bye = GUICtrlCreateButton("Close", 75, 65, 50, 30)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $start Then Winclose("Fake Anti Virus")
    If $msg = $bye Then Exit
WEnd

My 'Winclose' function doesn't work.

I was going to include the function "Sleep(GUIReadctrl($timer)" in, but I couldn't figure out how to add it.

The Label doesn't appear, also.

The idea is obviously that when the person leaves the room he runs it, enters about 2 minutes in the box then when they come back it starts doing the Opening of CD draw etc.

Also, is there a special type of box you use for number inputs instead of the one I used?

And the main problem is the first one- I can't include anything after the 'Winclose' function.

Anyone know what I'm doing wrong?

-Bob

Photoshop User and Noob AutoIt user.
Link to comment
Share on other sites

This should hide your GUI:

$maingui = GUICreate("Fake Anti Virus", 250, 100)
GUICtrlCreateLabel("Length Of time before program starts in Ms-1000ms=1 second, 60000=1 min", 50, 10, 100, 20, 0x0001)
$timer = GUICtrlCreateInput ( "Put Length of time here", -1, -1 )
$start = GUICtrlCreateButton("Go!", 75, 35, 50, 30)
$bye = GUICtrlCreateButton("Close", 75, 65, 50, 30)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $start Then Guisetstate(@SW_Hide, $maingui)
    If $msg = $bye Then Exit
WEnd

Neo

[center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center]

Link to comment
Share on other sites

Not only is this "joke" not funny, it's potentially dangerous. Imagine what would happen if somebody walked by the case as the disc tray extended. Anything from a cut to breaking the drive tray to toppling the PC or the person could result. Bet you didn't think of anything like that, did you?

Link to comment
Share on other sites

Not only is this "joke" not funny, it's potentially dangerous. Imagine what would happen if somebody walked by the case as the disc tray extended. Anything from a cut to breaking the drive tray to toppling the PC or the person could result. Bet you didn't think of anything like that, did you?

I believe the idea is you do it when they go out of the room to fetch something, so they're sitting at the PC when it happens, not walking past.

But no, I didn't think of that, I just thought I'd try to program it since I've only just started.

-Bob

Photoshop User and Noob AutoIt user.
Link to comment
Share on other sites

Not only is this "joke" not funny, it's potentially dangerous. Imagine what would happen if somebody walked by the case as the disc tray extended. Anything from a cut to breaking the drive tray to toppling the PC or the person could result. Bet you didn't think of anything like that, did you?

Well then, What about a script that says please insert the cd for <good usage here>. I suppose that is just evil eh? ;)

Time + Effort = Constant

Link to comment
Share on other sites

There are a lot of better jokes you can play with AutoIt. How about a nice SplashImage? You can do the old blue screen or something more original. Make a GUI shaped like a head and make it pop up on the screen at random intervals. Make the NumLock, CapsLock and Scroll Lock keys flash on and off. Make a TrayTip that says something using that person's name: "Bob, please stop pressing the keys so hard."

Use your imagination.

Edited by SerialKiller
Link to comment
Share on other sites

There are a lot of better jokes you can play with AutoIt. How about a nice SplashImage? You can do the old blue screen or something more original. Make a GUI shaped like a head and make it pop up on the screen at random intervals. Make the NumLock, CapsLock and Scroll Lock keys flash on and off. Make a TrayTip that says something using that person's name: "Bob, please stop pressing the keys so hard."

Use your imagination.

Those are pretty good ideas, though most of them sound beyond me, maybe I'll have a go when I finish this one since it seems for managable^^

-Bob

Photoshop User and Noob AutoIt user.
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...