Jump to content

Compiling Error


Recommended Posts

Hello!

I wrote those script, if I run it as script, it works properly, and no crashes at all... but if I compile it, it opens a lot of webpages and crashes :):(:D why?

#include <Constants.au3>
#include <GUIConstants.au3>
#NoTrayIcon

Opt("TrayMenuMode",1) 

Global $act = 1
Global $proc = "AutoItv3"

HotKeySet("{RIGHT}","_MouseRight")
HotKeySet("{LEFT}","_MouseLeft")
HotKeySet("{UP}","_MouseUp")
HotKeySet("{DOWN}","_MouseDown")
HotKeySet("{ENTER}","_MouseClick")
HotKeySet("{SPACE}","_MouseDoubleClick")
HotKeySet("{END}","_EndProgram")
HotKeySet("{PAUSE}","_ChangeScriptStatus")
HotKeySet("{PGDN}","_ScrollMouseDown")
HotKeySet("{PGUP}","_ScrollMouseUp")


$help = TrayCreateItem("Help")
$about = TrayCreateItem("About")
$exit = TrayCreateItem("Exit")

TraySetState()

While 1
    
    $msg = TrayGetMsg()

    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $help
            $title = "Help..."
            $text = "FRECCE -> Muove il cursore nella direzione voluta" & @CRLF & "ENTER -> Click singolo con il pulsante primario" & @CRLF & "SPACE -> Doppio click con il pulsante primario" & @CRLF & "PG DOWN -> Preme il pulsante primario del mouse" & @CRLF & "PG UP -> RIlascia il pulsante primario del mouse" & @CRLF & "PAUSE -> Attiva\Disattiva il programma" & @CRLF & "END -> Termina il programma"
            MsgBox(64,$title,$text)
        Case $msg = $about
            _loadAbout()
        Case $msg = $exit
            Exit 0
    EndSelect
    
    If ProcessExists($proc) Then
        ProcessSetPriority($proc, 4)
    EndIf

WEnd

Func _MouseRight()
    If $act = 1 Then
        $pos = MouseGetPos()
        MouseMove($pos[0] + 10,$pos[1], 0)
    Else
        HotKeySet("{RIGHT}")
        Send("{RIGHT}")
        HotKeySet("{RIGHT}","_MouseRight")
    EndIf
EndFunc

Func _MouseLeft()
    If $act = 1 Then
        $pos = MouseGetPos()
        MouseMove($pos[0] - 10,$pos[1], 0)
    Else
        HotKeySet("{LEFT}")
        Send("{LEFT}")
        HotKeySet("{LEFT}","_MouseLeft")
    EndIf
EndFunc

Func _MouseUp()
    If $act = 1 Then
        $pos = MouseGetPos()
        MouseMove($pos[0], $pos[1] - 10, 0)
    Else
        HotKeySet("{UP}")
        Send("{UP}")
        HotKeySet("{UP}","_MouseUp")
    EndIf
EndFunc

Func _MouseDown()
    If $act = 1 Then
        $pos = MouseGetPos()
        MouseMove($pos[0], $pos[1] + 10, 0)
    Else
        HotKeySet("{DOWN}")
        Send("{DOWN}")
        HotKeySet("{DOWN}","_MouseDown")
    EndIf
EndFunc

Func _MouseClick()
    If $act = 1 Then
        MouseClick("main")
    Else
        HotKeySet("{Enter}")
        Send("{Enter}")
        HotKeySet("{Enter}","_MouseClick")
    EndIf
    
EndFunc

Func _MouseDoubleClick()
    If $act = 1 Then
        $pos = MouseGetPos()
        MouseClick("main", $pos[0], $pos[1], 2)
    Else
        HotKeySet("{Space}")
        Send("{Space}")
        HotKeySet("{Space}","_MouseDoubleClick")
    EndIf
EndFunc

Func _EndProgram()
    Exit 0
EndFunc

func _ChangeScriptStatus()
    If $act=1 Then
        $act = 0
    Else
        $act = 1
    EndIf
EndFunc

Func _ScrollMouseDown()
    If $act=1 Then
        MouseDown("main")
    Else
        HotKeySet("{PGDN}")
        Send("{PGDN}")
        HotKeySet("{PGDN}","_ScrollMouseDown")
    EndIf
EndFunc

Func _ScrollMouseUp()
    If $act=1 Then
        MouseUp("main")
    Else
        HotKeySet("{PGUP}")
        Send("{PGUP}")
        HotKeySet("{PGUP}","_ScrollMouseUp")
    EndIf
EndFunc

Func _loadAbout()
    #Region ### START Koda GUI section ### Form=
    $AboutMsgBox = GUICreate("About...", 317, 63, -1, -1, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
    GUISetIcon("Info.ico")
    $Label1 = GUICtrlCreateLabel("Arrow Keys Commander 1.0 alpha", 104, 8, 202, 22)
    GUICtrlSetFont(-1, 10, 400, 0, "@Arial Unicode MS")
    $Label2 = GUICtrlCreateLabel("Created by", 104, 32, 67, 22)
    GUICtrlSetFont(-1, 10, 400, 0, "@Arial Unicode MS")
    $email = GUICtrlCreateLabel("Roberto Orgiu", 176, 32, 84, 22)
    GUICtrlSetFont(-1, 10, 400, 4, "@Arial Unicode MS")
    GUICtrlSetColor(-1, 0x0000FF)
    GUICtrlSetCursor (-1, 0)
    $Pic1 = GUICtrlCreatePic("somerights20_0.jpg", 8, 8, 89, 36, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetCursor (-1, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete()
                ExitLoop
            Case $email
                Run(@ComSpec & " /c " & 'start mailto:roberto.orgiu@gmail.com?subject=Arrow Keys Commander', "", @SW_HIDE)
            Case $Pic1
                _show()
        EndSwitch
    WEnd
EndFunc

Func _show()
    
    $license = GUICreate("Licenza", 269, 303, -1, -1, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
    GUISetIcon("Info.ico")
    GUISetCursor (7)
    GUISetBkColor(0xFFFFFF)
    $Pic1 = GUICtrlCreatePic("CreativeCommonsLogo.jpg", 0, 0, 268, 68, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Label1 = GUICtrlCreateLabel("Tu sei libero:", 96, 80, 79, 22)
    GUICtrlSetFont(-1, 10, 400, 2, "@Arial Unicode MS")
    GUICtrlSetCursor (-1, 7)
    $Label2 = GUICtrlCreateLabel("Alle seguenti condizioni:", 64, 160, 145, 22)
    GUICtrlSetFont(-1, 10, 400, 2, "@Arial Unicode MS")
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Pic2 = GUICtrlCreatePic("share_0.jpg", 40, 104, 44, 44, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Pic3 = GUICtrlCreatePic("remix_0.jpg", 184, 104, 44, 44, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Pic4 = GUICtrlCreatePic("by_0.jpg", 40, 184, 44, 44, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Pic5 = GUICtrlCreatePic("nc-eu_0.jpg", 112, 184, 44, 44, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Pic6 = GUICtrlCreatePic("sa_0.jpg", 184, 184, 44, 44, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Pic7 = GUICtrlCreatePic("somerights20_0.jpg", 80, 256, 105, 36, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetCursor (-1, 0)
    GUISetState(@SW_SHOW, $license)


    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete()
                ExitLoop
            Case $Pic7
                Run(@ComSpec & " /c " & 'start http://creativecommons.org/licenses/by-nc-sa/2.5/it/', "", @SW_HIDE)
        EndSwitch
    WEnd
EndFunc
Link to comment
Share on other sites

Hello!

I wrote those script, if I run it as script, it works properly, and no crashes at all... but if I compile it, it opens a lot of webpages and crashes :(:D :D why?

I don't see anything obvious, but you might try adding valid working directory parameters to your Run() functions.

:)

P.S. You also may need full paths to things like "somerights20_0.jpg".

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Could you try to compile it and see if is my compiler not working well, please? :(

No. But what symptoms do you have that your compiler is the issue? What version are you using? Are you doing this from SciTE so you get the full syntax check and console output to help debug?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Developers

if I compile with SciTe, it works properly, but if I use the other compiler to set another icon, it doesn't work :) why?

What other compiler ?

Scite/AutoIt3Wrapper use the standard AUT2EXE program as well.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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