Sign in to follow this  
Followers 0
taurus905

Hotkey that opens a text file.

5 posts in this topic

The topic says it all. This simple task has given me a headache and I would appreciate someone showing me what I am overlooking. I think I am burnt out today. This should be very easy.

Thanks in advance.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites



Global $hTxtFile = ''
HotKeySet('{ESC}', '_EXITNOW')
HotKeySet('!{HOME}', '_OpenText')

$hTxtFile = 'txt.txt';Making it global you can change the value anywhere.
While 1
    Sleep(1000000)
WEnd

Func _OpenText()
    ShellExecute($hTxtFile)
EndFunc

Func _EXITNOW()
    Exit
EndFunc


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Global $hTxtFile = ''
HotKeySet('{ESC}', '_EXITNOW')
HotKeySet('!{HOME}', '_OpenText')

$hTxtFile = 'txt.txt';Making it global you can change the value anywhere.
While 1
    Sleep(1000000)
WEnd

Func _OpenText()
    ShellExecute($hTxtFile)
EndFunc

Func _EXITNOW()
    Exit
EndFunc
SmOke_N,

You're the man.

ShellExecute is what I was looking for.

Thank you my friend.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

Your welcome, you could have done it with Run as well just so you know:

Global $hTxtFile = ''
HotKeySet('{ESC}', '_EXITNOW')
HotKeySet('!{HOME}', '_OpenText')

$hTxtFile = 'txt.txt';Making it global you can change the value anywhere.
While 1
    Sleep(1000000)
WEnd

Func _OpenText()
    Run(@ComSpec & ' /c "' & $hTxtFile & '"', '', @SW_HIDE)
EndFunc

Func _EXITNOW()
    Exit
EndFunc


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Your welcome, you could have done it with Run as well just so you know:

Global $hTxtFile = ''
HotKeySet('{ESC}', '_EXITNOW')
HotKeySet('!{HOME}', '_OpenText')

$hTxtFile = 'txt.txt';Making it global you can change the value anywhere.
While 1
    Sleep(1000000)
WEnd

Func _OpenText()
    Run(@ComSpec & ' /c "' & $hTxtFile & '"', '', @SW_HIDE)
EndFunc

Func _EXITNOW()
    Exit
EndFunc
SmOke_N,

I tried to use the Run command, but I forgot about @ComSpec which I have used in past programs. I guess I should have read the help file more closely again. It has been a long day.

Thanks again.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

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