Sign in to follow this  
Followers 0
ReaImDown

stringtrimright

10 posts in this topic

why does this not trim right?

#include<misc.au3>
$file = FileOpen("testing.txt",1)
while 1
    if _IsPressed("08") then StringTrimRight($file,1);backspace
    if _IsPressed("5a") Then;Z
        FileClose($file)
        Exit
    EndIf
WEnd

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites



why does this not trim right?

#include<misc.au3>
$file = FileOpen("testing.txt",1)
while 1
    if _IsPressed("08") then StringTrimRight($file,1);backspace
    if _IsPressed("5a") Then;Z
        FileClose($file)
        Exit
    EndIf
WEnd
You have your file open in write mode. You aren't reading anything in the file. Use FileRead to read the data and assign it to a variable and trim the variable.

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Share this post


Link to post
Share on other sites

@ReaImDown

FileRead is properly used for read files...

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

@ReaImDown

FileRead is properly used for read files...

Cheers, FireFox.

is there any other way?


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

#include<misc.au3>
$file = FileOpen("testing.txt", 1)
$fileread = FileRead($file)
While 1
    If _IsPressed("08") Then StringTrimRight($fileread,1);backspace
    If _IsPressed("5a") Then;Z
        FileClose($file)
        Exit
    EndIf
WEnd

You need something along the lines of...


My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Share this post


Link to post
Share on other sites

#include<misc.au3>
$file = FileOpen("testing.txt", 1)
$fileread = FileRead($file)
While 1
    If _IsPressed("08") Then StringTrimRight($fileread,1);backspace
    If _IsPressed("5a") Then;Z
        FileClose($file)
        Exit
    EndIf
WEnd

You need something along the lines of...

that would be the slower way of doing it, is there anything quicker?

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

Check out the user-defined functions for file management in the help file.


My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

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