Jump to content

Recommended Posts

Posted (edited)

First off, wow, my name is cocky, I dunno why it isn't my normal alias, anyone know where to change it?

Second, why doesn't this script work? :/
 

;By Redacted
HotKeySet("{F11}","close")
HotKeySet("{F12}","message_box")

dim $word[6]

$i = 0

$word[1] = "'Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction.'~Albert Einstein"
$word[2] = "Quote2"
$word[3] = "Quote3"
$word[4] = "Quote4"
$word[5] = "Quote5"

func close()
    $i = 1
EndFunc


func message_box()
    $random = random(1,5)
    msgbox(0,"Word of Wisdom",$word[$random])
EndFunc


Do
    ;This should mean the program keeps running until I hit F11
until $i = 1oÝ÷ Ùh^î²ØZ½æ®¶­sfFÒb33c·v÷&E³eТb33c·v÷&E³ÒÒgV÷C²b33´ççFVÆÆvVçBfööÂ6âÖ¶RFæw2&vvW"ÂÖ÷&R6öׯWÂæBÖ÷&RföÆVçBâBF¶W2F÷V6öbvVæW2ÒÒæBÆ÷Böb6÷W&vRÒÒFòÖ÷fRâFR÷÷6FRF&V7Föââb33·äÆ&W'BVç7FVâgV÷C°¢b33c·v÷&E³%ÒÒgV÷CµV÷FS"gV÷C°¢b33c·v÷&5ÒÒgV÷CµV÷FS2gV÷C°¢b33c·v÷&E³EÒÒgV÷CµV÷FSBgV÷C°¢b33c·v÷&E³UÒÒgV÷CµV÷FSRgV÷C°¢b33c·&æFöÒÒ&æFöÒÃR¦×6v&÷ÂgV÷Cµv÷&Böbv6FöÒgV÷C²Âb33c·v÷&E²b33c·&æFöÕÒ

it displays a message randomly fine but it doesn't work with functions.

Edited by BobiusMaximus
Photoshop User and Noob AutoIt user.
Posted

First off, wow, my name is cocky, I dunno why it isn't my normal alias, anyone know where to change it?

Second, why doesn't this script work? :/

;By Robert Woollins
HotKeySet("{F11}","close")
HotKeySet("{F12}","message_box")

dim $word[6]

$i = 0

$word[1] = "'Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction.'~Albert Einstein"
$word[2] = "Quote2"
$word[3] = "Quote3"
$word[4] = "Quote4"
$word[5] = "Quote5"

func close()
    $i = 1
EndFunc


func message_box()
    $random = random(1,5)
    msgbox(0,"Word of Wisdom",$word[$random])
EndFunc


Do
    ;This should mean the program keeps running until I hit F11
until $i = 1oÝ÷ Ùh^î²ØZ½æ®¶­sfFÒb33c·v÷&E³eТb33c·v÷&E³ÒÒgV÷C²b33´ççFVÆÆvVçBfööÂ6âÖ¶RFæw2&vvW"ÂÖ÷&R6öׯWÂæBÖ÷&RföÆVçBâBF¶W2F÷V6öbvVæW2ÒÒæBÆ÷Böb6÷W&vRÒÒFòÖ÷fRâFR÷÷6FRF&V7Föââb33·äÆ&W'BVç7FVâgV÷C°¢b33c·v÷&E³%ÒÒgV÷CµV÷FS"gV÷C°¢b33c·v÷&5ÒÒgV÷CµV÷FS2gV÷C°¢b33c·v÷&E³EÒÒgV÷CµV÷FSBgV÷C°¢b33c·v÷&E³UÒÒgV÷CµV÷FSRgV÷C°¢b33c·&æFöÒÒ&æFöÒÃR¦×6v&÷ÂgV÷Cµv÷&Böbv6FöÒgV÷C²Âb33c·v÷&E²b33c·&æFöÕÒ

it displays a message randomly fine but it doesn't work with functions.

If you mean you would like to have something like

$word[5] = "_function5"

then that is difficult in AutoIt. It would be easier to have something like

func message_box()
    $random = random(1,5,1)
    msgbox(0,"Word of Wisdom",MyWord($random))
EndFunc

Func MyWord($iw)
 switch $iw
  Case 1 to 4
    Return  $word[$iw]
  Case 5
   Return _Function5()
.
.
.
 EndSwicth

endfunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

this is a tricky one :D

try to use something other than F12 as your hotkey, i recall reading something like F12 is reserved for something else.

not sure tho :D

Posted

this is a tricky one :D

try to use something other than F12 as your hotkey, i recall reading something like F12 is reserved for something else.

not sure tho :D

You're right tapeworm09, from the help

F12 It is also reserved by Windows, according to its API.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

this is a tricky one :D

try to use something other than F12 as your hotkey, i recall reading something like F12 is reserved for something else.

not sure tho :D

<3

F10 works :)

Thanks.

Photoshop User and Noob AutoIt user.
Posted (edited)

;By Robert Woollins
HotKeySet("{F11}","close")
HotKeySet("{F10}","send_to_keyboard")
HotKeySet("{F9}","message_box")

dim $word[219]

$i = 0

;All my quotes are here, I won't both showing them for space reasons.

Func close()
    $i = 1
EndFunc


Func message_box()
    $random = random(1,218)
    $last_word = $word[$random]
    msgbox(32,"Word of Wisdom",$last_word)
EndFunc

func send_to_keyboard()
    send($last_word)
EndFunc
Do
    ;This means the program keeps running until I hit F11
until $i = 1

The send($last_word) is not working...why not?

Edited by BobTheLeetHaxx0r
Photoshop User and Noob AutoIt user.
Posted

;By Robert Woollins
HotKeySet("{F11}","close")
HotKeySet("{F10}","send_to_keyboard")
HotKeySet("{F9}","message_box")

dim $word[219]

$i = 0

;All my quotes are here, I won't both showing them for space reasons.

Func close()
    $i = 1
EndFunc


Func message_box()
    $random = random(1,218)
    $last_word = $word[$random]
    msgbox(32,"Word of Wisdom",$last_word)
EndFunc

func send_to_keyboard()
    send($last_word)
EndFunc
Do
    ;This means the program keeps running until I hit F11
until $i = 1

The send($last_word) is not working...why not?

$lastword is only set in the function message_box. Since it is not declared as a global variable send_to_keyboard has no knowledge of it. The cure is simply to add

Global $last_word

in your main script.

Would be a good idea to add a sleep(20) say in your do/until loop to reduce CPU usage.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted (edited)

Ah thanks.

In school I've spent like...half a year doing true basic programming(It's a horrible language if you didn't know) & it doesn't need them to be done like that.

Ed:

My F-Secure Anti Virus won't let me compile it now...help?

Ed2:

It works :D

Edited by BobTheLeetHaxx0r
Photoshop User and Noob AutoIt user.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...