Jump to content

plz help me the programme doesn "t work


Recommended Posts

hi every buddy

i wrote a simple code

with this code i can creat a file when i press a button in the clipboard but the code doesn "t work well

this is the code plzz help me

HotKeySet ("{a}" , "a")



func a ()
    FileWrite ("c:\txt.txt" , "hello")
EndFunc

when i run the code he show and hide fastely

plz help me i want the code still show untill i stop it

thanks you

Edited by dallasgfx
Link to comment
Share on other sites

hi every buddy

i wrote a simple code

with this code i can creat a file when i press a button in the clipboard but the code doesn "t work well

this is the code plzz help me

HotKeySet ("{a}" , "a")

func a ()
    FileWrite ("c:\txt.txt" , "hello")
EndFunc

when i run the code he show and hide fastely

plz help me i want the code still show untill i stop it

thanks you

The script exits because there is nothing to do. Add a while loop to keep the script active:
While 1
     Sleep(10)
WEnd

:P

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

This thread does not make any sense! ....unless some posts have been deleted, even then.... :P

what !! , i want to correct my code

when i pross button "a" . i want to creat a file and in the samr time write word "a"

that's all

Link to comment
Share on other sites

  • Developers

what !! , i want to correct my code

Which code?

You are not showing anything and we aren't clairvoyant (yet).

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

Try this...

Global Const $filename = "c:\txt.txt"
HotKeySet ("{a}" , "a")

While 1
     ; Wait to Exit
Wend
; ShellExecute($filename, "", @ScriptDir, "edit")

func a ()
    $file = FileOpen($filename, 1)
    ; Check if file opened for writing OK
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file." & @CRLF & $filename)
        Exit
    EndIf
    FileWrite ($file , "hello")
    FileClose($file)
EndFunc
Link to comment
Share on other sites

Which code?

You are not showing anything and we aren't clairvoyant (yet).

Question. Why don't we have a clairvoyant() function in AutoIt yet?

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Could you at least show an example of what you want written to the file and what you want written to the clipboard?

If you want to place something on the clipboard then you use ClipPut("Something"). If you want to append something to the clipboard then use ClipPut(ClipGet() & "Something") and make sure that you empty the clipboard first by using ClipPut("")

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Show some example code. That's my final answer. If you can't provide us with more details then I have a feeling the thread will be locked before you ever get a reply.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

You cannot write to a file that has not been opened !

Oh yes you can. It's not a good practice but it can be done.

$hFile = @DesktopDir & "\mytest.txt"
For $i = 1 to 10
    FileWriteLine($hFile, $i)
Next
ShellExecute($hFile)
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

If I did not know different, I would swear you are trolling this forum ! :P

In the code, Change FileWrite ($file , "hello") to FileWrite ($file , "a")

i try your code but when i click in button "a" it doesn"t write "a" it just creat the file

Link to comment
Share on other sites

My new Clairvoyant() function tells me that this thread is becoming totally useless.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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