Sign in to follow this  
Followers 0
Joosh

How do i run a precreated txt document

7 posts in this topic

#1 ·  Posted (edited)

Okay, I already know that this is possible with

Run("Notepad.exe" "Test.txt")

However, this seems to only work if the .txt document is located directly within the main autoit folder

I would like to know how i can make it know exactly where the .txt document is and locate it and run it.

Any help would be greatly appreciated

Edited by Joosh

Share this post


Link to post
Share on other sites



You could send Notepad a full path like so:

Run('Notepad.exe "C:\My Documents\Test.txt"')

Or alternatively if you have the filename in a variable:

$File = "C:\My Documents\Test.txt"
Run('Notepad.exe "' & $File & '"')

Share this post


Link to post
Share on other sites

Okay thats helpful in the short term but this program is going to be carted around and moved from computer to computer each time probably being placed in a different directory, the .txt file and .exe file will both be bundled in the same folder, how can i make autoit understand that the .txt file is in the same folder as the .exe that is being run and go from there?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$File = @ScriptDir & "\SomeFile.txt"
Run('Notepad.exe "' & $File & '"')

otherwise in the exe u could place this

$file = @WorkingDir & "\SomeFile.txt"
Run('Notepad.exe "' & $File & '"')

coded with beta .65

@WorkingDir = Current/active working directory. (Result does not contain a trailing backslash)

@ScriptDir = Directory containing the running script. (Result does not contain a trailing backslash)

have to use a trainling backslash as there isnt one included...

Cheers

Edited by WSCPorts

http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks heaps mate.

Okay and using that how would i call the program

$e = @ScriptDir & "\POSRecord.txt"

Run($e)????

I am a noobie ^^;

Edited by Joosh

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

$e = @ScriptDir & "\POSRecord.txt"

Run('Notepad.exe "' & $e & '"')

Aim im Ban1337 :0_o:

Edited by WSCPorts

http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32]

Share this post


Link to post
Share on other sites

Thanks again mate, any chance you use msn?

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