View previous topic :: View next topic |
Author |
Message |
Shahryar Advanced Cheater Reputation: 0
Joined: 11 Jun 2011 Posts: 85
|
Posted: Tue Apr 03, 2012 11:37 am Post subject: I have question. [Global Variables] |
|
|
Hello everyone.
I have question like always.
How can I:
1. create or delete a folder with CE.
2. delete a file with CE.
3. use of global variables in CE. in AutoPlay Media Studio 8, we can use of the following variables:
_SystemFolder
The path to the user's Windows System folder (e.g. "C:\Windows\System" on non-NT systems, and "C:\Windows\System32" on NT based systems).
_TempFolder
The path to the user's Temp folder.
_WindowsFolder
The path to the user’s Windows folder (e.g. "C:\Windows").
_DesktopFolder
The path to the user's Desktop folder. On Windows NT/2000/XP/Vista or later, this is the path from the per-user profile.
_DesktopFolderCommon
The path to the user's Desktop folder. On Windows NT/2000/XP/Vista or later, this is the path from the All Users profile. On a non-Windows NT system, this will simply be the path to the user's Desktop folder (the same as _DesktopFolder).
_ProgramFilesFolder
The user's Program Files folder (typically, this is something like "C:\Program Files").
AutoPlay Media Studio 8 using of lua script. Is this variables available in CE?
Thanks for your advices.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
|
Posted: Tue Apr 03, 2012 11:46 am Post subject: |
|
|
To delete a file, you can use 'os.remove'.
To create a file you can use 'io.open'.
As for the global variables those are exposed to Lua by the application itself. You wont have direct access to them with Cheat Engines Lua engine because it does not expose them itself.
You can access environment variables with 'os.getenv' though, such as:
Code: | local tempFolder = os.getenv( "temp" );
print( tempFolder ); |
_________________
- Retired. |
|
Back to top |
|
|
Shahryar Advanced Cheater Reputation: 0
Joined: 11 Jun 2011 Posts: 85
|
Posted: Tue Apr 03, 2012 11:56 am Post subject: |
|
|
Wiccaan:
Can you give me a sample of 'os.remove' and 'io.open'? I'll follow of your samples.
And How can I create or delete a folder? Thanks
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
|
Posted: Tue Apr 03, 2012 12:22 pm Post subject: |
|
|
os.remove:
Code: | os.remove( "C:\\example_folder\\example_file.txt" ) |
io.open:
Code: | local f = io.open( "C:\\example_folder\\example_file.txt", "w" );
f:write( "Hello world!" );
f:close(); |
To delete a folder:
Code: | os.execute( [[ rd /s /q "C:\\example_folder" ]] ); |
_________________
- Retired. |
|
Back to top |
|
|
Shahryar Advanced Cheater Reputation: 0
Joined: 11 Jun 2011 Posts: 85
|
Posted: Tue Apr 03, 2012 12:31 pm Post subject: |
|
|
Thanks a lot Wiccaan. and one more question, How can I create a folder? Thanks.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
|
Posted: Tue Apr 03, 2012 12:54 pm Post subject: |
|
|
Code: | os.execute( [[ md "C:\\example_folder" ]] ); |
_________________
- Retired. |
|
Back to top |
|
|
Shahryar Advanced Cheater Reputation: 0
Joined: 11 Jun 2011 Posts: 85
|
Posted: Tue Apr 03, 2012 1:02 pm Post subject: |
|
|
sorry. I forgot. How can I find installed windows dir with CE? like 'C:\'
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
|
Posted: Tue Apr 03, 2012 2:08 pm Post subject: |
|
|
Shahryar wrote: | sorry. I forgot. How can I find installed windows dir with CE? like 'C:\' |
Like this:
Code: | local osDisk = os.getenv( "SystemDrive" );
print( osDisk ); |
_________________
- Retired. |
|
Back to top |
|
|
Shahryar Advanced Cheater Reputation: 0
Joined: 11 Jun 2011 Posts: 85
|
Posted: Tue Apr 03, 2012 7:59 pm Post subject: |
|
|
Hello again Wiccaan.
I have another question. How can I check a file by CE that exists or not?
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
|
Posted: Wed Apr 04, 2012 2:09 pm Post subject: |
|
|
You can test by trying to open the file like this:
Code: |
function io.exist( fileName )
local f = io.open( fileName );
if ( f == nil ) then
return false;
end
f:close();
return true;
end
print( "C:\\example_folder\\example.txt status: " .. tostring( io.exist( "C:\\example_folder\\example.txt" ) ) );
|
_________________
- Retired. |
|
Back to top |
|
|
Shahryar Advanced Cheater Reputation: 0
Joined: 11 Jun 2011 Posts: 85
|
Posted: Mon Apr 09, 2012 8:01 am Post subject: |
|
|
Thanks a lot Wiccaan.
|
|
Back to top |
|
|
|