Jump to content

Recommended Posts

Posted

Success: Returns a file "handle" or use with subsequent file functions.

How do I know the name of the 'handle'?

I would like to open a file and then read from it, but I don't know what to put as the file handle after I open it.

FileReadLine ( filehandle or "filename" [, line] )

What do I put in the bold area?

A little reading goes a long way. Post count means nothing.

Posted

$hFile = FileOpen("your file")
If $hFile = -1 Then Exit; Failed to open the file
$szLine = FileReadLine($hFile)

The handle is the return value of FileOpen. -1 indicates failure.

Posted (edited)

Sorry for the stupid questions, this is my first time using Version 3.

Ok, I see how to set a HotKey, that's pretty easy. Now I would like my script to pause untill a hotkey is pressed.

How would I go about that?

Edit: Ok, another question. I would like to send a set line of text, a variable, and then the Enter key. This is what I have:

Send ("Text" & $Variable & '{ENTER}')

It sends the text and the variable but does not press the enter key at the end. I have tried many variations of it with no luck. Any help is greatly appreciated.

Peeee Essss I didn't want to start a whole new topic for something so stupid :)

Edited by Snarg

A little reading goes a long way. Post count means nothing.

Posted

This should help accomplish what you want.

Global $PAUSED = 0  ; 1 = paused, 0 = not paused
HotKeySet("{Pause}", "TogglePauseState")

; body of script would go here
; To start the script in a paused state,
; you would say Call("TogglePauseState")
Exit

Func TogglePauseState()
   $PAUSED = Not $PAUSED ;toggle
   While $PAUSED
      Sleep(100)
   WEnd
EndFunc

I have no idea why the send is failing; it looks right. Where are you trying to send the text to? You might try using ControlSend (see help file).

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

Oddly enough, this send works:

Send ("text" & $variable & "{ENTER}")

Thank you for your help.

A little reading goes a long way. Post count means nothing.

Posted

Oddly enough, this send works:

Send ("text" & $variable & "{ENTER}")

Are you saying that it works when {Enter} is enclosed in double quotes but does not work when enclosed in single quotes?!?

Try it again, please, and let us know. Perhaps there is some AutoIt bug :whistle:

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

Are you saying that it works when {Enter} is enclosed in double quotes but does not work when enclosed in single quotes?!?

Try it again, please, and let us know.  Perhaps there is some AutoIt bug  :think:

That's odd. It works both ways. Bizzare.

A little reading goes a long way. Post count means nothing.

Posted

That's odd. It works both ways. Bizzare.

Its not odd. What CyberSlug was trying to convey is this:

$var = "{SPACE}"

Send("abcd" & $var & "efgh")

Instead of sending the characters {,S,P,A,C,E,} as you might think, it interprets that as {SPACE}.

Output would be: abcd efgh

Using Send("abcd" & $var & "efgh", 1) tells it to send the characters raw, so none of the special {<word>} type things work.

Output: abcd{SPACE}efgh

In relevance to your situation, if $var would of contained a { or something, it would pretty much mess up all the rest of the stuff being sent in that line. So this will work as long as there is no { or a properly constructed {<word>} item in $var:

Send("test" & $var & "{ENTER}")

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...