Sign in to follow this  
Followers 0
zeroZshadow

open file

6 posts in this topic

why doesn't it just open the damn file???

#include <GuiConstants.au3>
FileInstall("C:\Program Files\AutoIt3\AutoIt3.exe",@ScriptDir&"\AutoIt3.exe")
Opt("GUIOnEventMode",1)
Opt("SendAttachMode",1)
If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
GuiCreate("calculator", 179, 144,(@DesktopWidth-179)/2, (@DesktopHeight-144)/2)

$Button_1 = GuiCtrlCreateButton("1", 10, 100, 30, 30)
$Button_2 = GuiCtrlCreateButton("2", 40, 100, 30, 30)
$Button_3 = GuiCtrlCreateButton("3", 70, 100, 30, 30)
$Button_4 = GuiCtrlCreateButton("4", 10, 70, 30, 30)
$Button_5 = GuiCtrlCreateButton("5", 40, 70, 30, 30)
$Button_6 = GuiCtrlCreateButton("6", 70, 70, 30, 30)
$Button_7 = GuiCtrlCreateButton("7", 10, 40, 30, 30)
$Button_8 = GuiCtrlCreateButton("8", 40, 40, 30, 30)
$Button_9 = GuiCtrlCreateButton("9", 70, 40, 30, 30)
$output = GuiCtrlCreateInput("", 10, 10, 150, 20)
$Buttonplus = GuiCtrlCreateButton("+", 100, 40, 30, 30)
$Buttonminus = GuiCtrlCreateButton("-", 130, 40, 30, 30)
$Buttontime = GuiCtrlCreateButton("X", 100, 70, 30, 30)
$Buttonslash = GuiCtrlCreateButton("/", 130, 70, 30, 30)
$Buttonis = GuiCtrlCreateButton("=", 100, 100, 60, 30)
GuiSetState()
GUICtrlSetOnEvent ($Button_1, "_click" )
GUICtrlSetOnEvent ($Button_2, "_click" )
GUICtrlSetOnEvent ($Button_3, "_click" )
GUICtrlSetOnEvent ($Button_4, "_click" )
GUICtrlSetOnEvent ($Button_5, "_click" )
GUICtrlSetOnEvent ($Button_6, "_click" )
GUICtrlSetOnEvent ($Button_7, "_click" )
GUICtrlSetOnEvent ($Button_8, "_click" )
GUICtrlSetOnEvent ($Button_9, "_click" )
GUICtrlSetOnEvent ($Buttonplus, "_click" )
GUICtrlSetOnEvent ($Buttonminus, "_click" )
GUICtrlSetOnEvent ($Buttontime, "_click" )
GUICtrlSetOnEvent ($Buttonslash, "_click" )
GUICtrlSetOnEvent ($Buttonis, "_click" )
GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")

while 1
    sleep(50)
WEnd

;FUNCTIONS
Func _Exit()
    FileDelete("AutoIt3.exe")
    Exit
EndFunc

Func _click()
    Select
        Case @GUI_CtrlId = 3
            ControlSend ( "calculator", "",12,"1")
        Case @GUI_CtrlId = 4
            ControlSend ( "calculator", "",12,"2")
        Case @GUI_CtrlId = 5
            ControlSend ( "calculator", "",12,"3")
        Case @GUI_CtrlId = 6
            ControlSend ( "calculator", "",12,"4")
        Case @GUI_CtrlId = 7
            ControlSend ( "calculator", "",12,"5")
        Case @GUI_CtrlId = 8
            ControlSend ( "calculator", "",12,"6")
        Case @GUI_CtrlId = 9
            ControlSend ( "calculator", "",12,"7")
        Case @GUI_CtrlId = 10
            ControlSend ( "calculator", "",12,"8")
        Case @GUI_CtrlId = 11
            ControlSend ( "calculator", "",12,"9")
        Case @GUI_CtrlId = 13
            GUICtrlSetData (12,"+",1)
        Case @GUI_CtrlId = 14
            GUICtrlSetData (12,"-",1)
        Case @GUI_CtrlId = 15
            GUICtrlSetData (12,"*",1)
        Case @GUI_CtrlId = 16
            GUICtrlSetData (12,"/",1)
        Case @GUI_CtrlId = 17
            _Calc(GUICtrlRead ($output))
    EndSelect
EndFunc

Func _Calc($var)
    $file = Fileopen("calc2.au3",3)
    FileWrite("calc2.au3","$var2 = "&$var&@CRLF&"ControlSend ( 'calculator', '',12,' = '&$var2,1)")
    FileClose($file)
    sleep(500)
    Run("AutoIt3.exe calc2.au3")
    FileDelete("Calc2.au3")
EndFunc

pleas help me with this one.

pleas don't ask why i make it, because i don't know myself.

( i do know but you'll see it in the scraps later when its done)


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites



I'll bite.. what is mode 3 on FileOpen. The help file lists

0 = Read mode

1 = Write mode (append to end of file)

2 = Write mode (erase previous contents)

Share this post


Link to post
Share on other sites

why doesn't it just open the damn file???

( i do know but you'll see it in the scraps later when its done)

<{POST_SNAPBACK}>

because you are deleting the file before autoit3 opens.

try using runwait().... :lmao:


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I'll bite.. what is mode 3 on FileOpen. The help file lists

  0 = Read mode

  1 = Write mode (append to end of file)

  2 = Write mode (erase previous contents)

<{POST_SNAPBACK}>

Well duh, obviously mode 3 is when you erase the previous contents AND append to the end of the file. I guess it's only obvious to a coder of my magnitude. :lmao:

Share this post


Link to post
Share on other sites

I'll bite.. what is mode 3 on FileOpen. The help file lists

  0 = Read mode

  1 = Write mode (append to end of file)

  2 = Write mode (erase previous contents)

<{POST_SNAPBACK}>

The fileopen() statement is useless anyway since the FileWrite() statement has the filename in it and not the filehandle that would be the result of FileOpen.

In other words: both fileOpen and fileclose are obsolete in this code.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

THANKS FOR THE HELP!!!

i'm gonna try it right away

Edit:

SWEET, it works now!! thanks guys.

now i can go and make my media player.

for information: i'm making all kind of little handy program to put in one file.

1. notepad - done

2. calc - done (thanks to u)

3. media player - starting

4. e-mail - on the list

5.messenger* -maby when my server in online

Edited by zeroZshadow

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
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
Sign in to follow this  
Followers 0