Hi! Really love the tutorial - Helped get me started. Hate to ask a question on my first post.. But I can't seem to get this damned script to work. Basically the GUI opens and asks you to into the pixel colour of the monster under the mouse (And this is found by pressing Alt+A and copy and pasting into top box), and also what you want it to say every 15 minutes... The problem being that I'm pretty sure I haven't used the variables in the right way - What should happen is when you click start, it takes the $pixel variable and then sets it as the pixel to find when it scans every 3 seconds.. This is where it stops working... it works fine without the GUI and just having a predefined pixel colour. Also the say command doesn't seem to work either - any help with that would be great!
Code:
#include <GUIConstants.au3>
Dim $start, $var, $pos, $say, $pixel, $pixelcolor, $btn
HotKeySet("!x","QuitLoop")
Func QuitLoop()
$start=0
EndFunc
GUICreate("Choose your options", 400, 250)
GUICtrlCreateLabel("Colour of Pixel:", 30, 10)
$pixel = GUICtrlcreateinput("", 30, 31, 200, 20)
GUICtrlCreateLabel("What to say:", 30, 68)
$say = GUICtrlcreateinput("Hi just watching movie so not really paying attention", 30, 88, 350, 20)
GUICtrlCreateLabel("Colour under mouse: (Press Alt+A to update)", 30, 170)
hotkeyset("!a","change")
Func change()
$pos=mousegetpos()
$var=PixelGetColor ( $pos[0] , $pos[1] )
GUIctrlcreateinput($var, 30, 190, 150, 20)
EndFunc
$btn = GUICtrlCreateButton("Start", 350, 200, 40)
GUISetState(@SW_SHOW)
$msg = 0
While $msg <> $GUI_EVENT_CLOSE
* * * $msg = GUIGetMsg()
* * * * * Select
* * Case $msg = $btn
* *$pixelcolor = $pixel
* *GUISetState(@SW_HIDE)
* *$start = 1
* * * EndSelect
Wend
While $start=1
$coord = Pixelsearch(8, 33, 519, 416, $pixelcolor)
If @error <> 1 then
MouseClick("left", $coord[0], $coord[1] )
Endif
sleep(3000)
WEnd
While $start=1
Send($say)
Send("{ENTER}")
sleep(900000)
WEnd
I got a really small screen - So just ignore coordinates of pixel search - ANYONE HELP PLEASE!
Below is a compiled version of the script!
<hr>
Append on Jul 22 2007, 06:08<hr>
Quote:
Originally posted by eRaSeR!@Jun 19 2007, 22:21
+k! nice!!
but i got a question:
FileMove ( "source", "dest" [, flag] ) that moves a file from A to B
lets make an example: FileMove("D:\AutoIt1.au3","D:\123\A utoIt1.au3")
the filename i want to move is "Autoit1.au3" but if i change the name of this file, it wont work anymore. how to say "move this file to D:\123"??
i hope u can understand me :D my english is not the best
|
Hey, not sure if I understood correctly but try adding the flag FileMove("D:\AutoIt1.au3","D:\123\A utoIt1.au3",
9) That will make it create the directory if it doesn't exist and also overwrite.. *Read below if that doesn't help*
Quote:
FILEMOVE:
Moves one or more files
FileMove ( "source", "dest" [, flag] )
Parameters
source: The source path and filename of the file to move. (* wildcards are supported)
dest: The destination path and filename of the moved file. (* wildcards are supported)
flag: [optional] this flag determines whether to overwrite files if they already exist:
Can be a combination of the following:
0 = (default) do not overwrite existing files
1 = overwrite existing files
8 = Create destination directory structure if it doesn't exist (See Remarks).
Return Value
Success: Returns 1.
Failure: Returns 0 if source cannot be moved or if dest already exists and flag=0.
Remarks
If the source and destination paths are on different volumes a copy and delete operation is performed rather than a move.
Because AutoIt lacks a "FileRename" function, use FileMove to rename a file!
The destination directory must already exist, except using with flag value '8'.
For instance the combined flag '9' (1 + 8) overwrites the target file and prechecks for the destination directory structure and if it doesn't exist creates it automatically.
Some file attributes can make the overwriting impossible.
Code:
Example
FileMove("C:\foo.au3", "D:\mydir\bak.au3")
; Second example:
; uses flags '1' (owerwriting) and '8' (autocreating target dir structure) together
; moves all txt-files from temp to txtfiles and prechecks if
; target directory structure exists, if not then automatically creates it
FileMove(@TempDir & "\*.txt", @TempDir & "\TxtFiles\", 9)
|