Jump to content

Script help, incudes small gui question...


Recommended Posts

... Im runnin it I checked it I cant figure out why it isnt writing them to file...

I plan to have a "hit 1 get pos y in first input x in second, hit 2 get y in third x in fourth" command down the road but with manual input im having issues...

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
Opt("GUIOnEventMode", 1)

;HotKeySet("{1}", "y1x1")
;HotKeySet("{2}", "y2x2")
$file = "DeathsAutoMove.txt"

Func y1x1()
    $y1 = MouseGetPos(1)
    $x1 = MouseGetPos(0)
    
    EndFunc

Func y2x2()
    $y2 = MouseGetPos(1)
    $x2 = MouseGetPos(0)
    
    EndFunc

Func save()
    $Input_1 = $y1
    $Input_2 = $x1
    $Input_3 = $y2
    $Input_4 = $x2
    FileOpen ( $file, 2 )
    FileWriteLine($file, $y1)
    FileWriteLine($file, $x1)
    FileWriteLine($file, $y2)
    FileWriteLine($file, $x2)
    GUIDelete ()
    FileClose( $file )
    MSgBox(1, "Death's AutoMove", "Thank You for your use and support of Death's d2 Products.")
Exit
    EndFunc
    
Func cancel()
    GUIDelete ()
    MSgBox(1, "Death's AutoMove", "Thank You for your use and support of Death's d2 Products.")
    Exit
EndFunc

        If $file = -1 Then
            $y1 = 0
            $x1 = 0
            $y2 = 0
            $x2 = 0
        Else
            $y1 = FileReadLine( $file, 1)
            $x1 = FileReadLine( $file, 2)
            $y2 = FileReadLine( $file, 3)
            $x2 = FileReadLine( $file, 4)
        EndIf
        
        

GuiCreate("Death's AutoMove", 371, 194,(@DesktopWidth-371)/2, (@DesktopHeight-194)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Input_1 = GuiCtrlCreateInput($y1, 220, 40, 55, 20)
$Input_2 = GuiCtrlCreateInput($x1, 150, 40, 55, 20)
$Input_3 = GuiCtrlCreateInput($y2, 220, 90, 55, 20)
$Input_4 = GuiCtrlCreateInput($x2, 150, 90, 55, 20)
$save = GuiCtrlCreateButton("Save", 50, 150, 120, 30)
GUICtrlSetOnEvent($save, "save")
$cancel = GuiCtrlCreateButton("Cancel", 190, 150, 130, 30)
GUICtrlSetOnEvent($cancel, "cancel")
$Icon_5 = GuiCtrlCreateIcon("Icon5", 0, 10, 10, 110, 110)
$Label_6 = GuiCtrlCreateLabel("Item 1:", 130, 10, 210, 20)
$Label_7 = GuiCtrlCreateLabel("Item 2:", 130, 70, 210, 20)

GUISetState (@SW_SHOW)
While 1
  Sleep(1000)   
WEnd

My thinking is maybe i should put the save function at the end, but im really not sure at all....

also Im looking to make a function to set them automaticly... is there a gui command to like... re-do the input boxes, so as it gets the x and y it puts them in and shows them :lmao:?

Edited by cdm_Death
Link to comment
Share on other sites

Well your HotKeySet's are commented out .. thus they'll never do anything.

The first 2 functions do the exact same thing and will never be called (see above).

The rest of the functions aren't called from anywhere, thus it's not going to do anything.

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

$save = GuiCtrlCreateButton("Save", 50, 150, 120, 30)
GUICtrlSetOnEvent($save, "save")
$cancel = GuiCtrlCreateButton("Cancel", 190, 150, 130, 30)
GUICtrlSetOnEvent($cancel, "cancel")

Thoes should call the functions, right now I have the hotkeys commented out so that I can test just the function "save"

cancel works fine...

the issue is when

$Input_1 = GuiCtrlCreateInput($y1, 220, 40, 55, 20)
$Input_2 = GuiCtrlCreateInput($x1, 150, 40, 55, 20)
$Input_3 = GuiCtrlCreateInput($y2, 220, 90, 55, 20)
$Input_4 = GuiCtrlCreateInput($x2, 150, 90, 55, 20)

This should (If im not mistaken)

this should make each input the variables $input_#

so that whene save is called;

Func save()
    $Input_1 = $y1
    $Input_2 = $x1
    $Input_3 = $y2
    $Input_4 = $x2
    FileOpen ( $file, 2 )
    FileWriteLine($file, $y1)
    FileWriteLine($file, $x1)
    FileWriteLine($file, $y2)
    FileWriteLine($file, $x2)
    GUIDelete ()
    FileClose( $file )
    MSgBox(1, "Death's AutoMove", "Thank You for your use and support of Death's d2 Products.")
Exit
    EndFunc

It should write convert each input variable to its corresponding $y#, and then write thoes to the file $file

The issue is it commes up with a blank file... my next step will be to make a hotkey get the position of the mouse and put it into thoes input spaces, but untill i get the base to work im not adding features.

Please help :lmao:

Edited by cdm_Death
Link to comment
Share on other sites

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