Jump to content
Sign in to follow this  
Rawox

StringReplace not working?

Recommended Posts

Rawox

Hi!

What am I doing wrong??

$String = GUICtrlRead ( $RandomKiriban )
    StringReplace ( $String, "," , "" )

Input:

$RandomKiriban = GUICtrlCreateInput ( "", 10, 300, 240, 20, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )

It needs to replace the , with spaces

Share this post


Link to post
Share on other sites
ProgAndy

the string supplied as a parameter is not changed. You have to read the return value of StringReplace:

$String = StringReplace ( $String, "," , "" )

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
Rawox

the string supplied as a parameter is not changed. You have to read the return value of StringReplace:

$String = StringReplace ( $String, "," , "" )

Wow, I don't get it :S

Explain please ^_^

Share this post


Link to post
Share on other sites
MrCreatoR

Explain please

Help file can explain those things very well ^_^

Return Value

Returns the new string, the number of replacements performed is stored in @extended.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
Rawox

I've already read the help file, and now also the return part...

But. I don't know how it works :S

Guys, I'm 15! ^_^ Please give a explanation for dummies ;)

Share this post


Link to post
Share on other sites
Valuater

Hi!

What am I doing wrong??

$String = GUICtrlRead ( $RandomKiriban )
     StringReplace ( $String, "," , "" )

Input:

$RandomKiriban = GUICtrlCreateInput ( "", 10, 300, 240, 20, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )

It needs to replace the , with spaces

This appears impossible overall....

$RandomKiriban is an input control with $ES_NUMBER, that means ONLY numbers can be entered.

To read the control is ok, but to try to replace a comma with a space should not work because ONLY numbers were allowed to be typed into the input.

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
Rawox

This appears impossible overall....

$RandomKiriban is an input control with $ES_NUMBER, that means ONLY numbers can be entered.

To read the control is ok, but to try to replace a comma with a space should not work because ONLY numbers were allowed to be typed into the input.

8)

Ow damn, I made a mistake ^_^ I meant that all ,'s need to be erased, no spaces. Just nothing ;)

Share this post


Link to post
Share on other sites
Valuater

Best thing is for you to give us a small example script that shows the problem, then we can help you!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Rawox

Well,, just an explanation of what it needs to do.

1. The script retrieves a number (for example: 11,222)

2. This number will be putten in an input $RandomKiriban

3. Then all the comma's of this number needs to be deleted.

4. The end result will then be 11222, this will be putted in the $RandomKiriban Input

Share this post


Link to post
Share on other sites
Valuater

again... "example code"?

It is real important so we can try to follow what you want. We can not read your mind BUT we can read script better than you and fix this!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Rawox

Ok!

This creates the input:

$RandomKiriban = GUICtrlCreateInput ( "", 10, 300, 240, 20, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )

This will select the text and paste it into the input, because the number can be different, it deletes all the letters and spaces behind it.

Send ( "+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}" )
    Send ( "^c" )
    $KiribanRecieved = ClipGet ( )
    GUICtrlSetData ( $RandomKiriban, $KiribanRecieved )
    $Reader = GUICtrlRead ( $RandomKiriban )
;//////////////////////////////////////////////////////////////////////////////DELETES ALL LETTERS//////////////////////////////////////////////////////////////////////
    If StringInStr ( $Reader, "o" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 1 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "t" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 2 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, " ", 0, 2 ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 3 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "s" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 4 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "w" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 5 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "e", 0, 2 ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 6 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "i" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 7 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "v" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 8 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "e", 0, 1 ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 9 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "g" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 10 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "g" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 11 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "a" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 12 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "p" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 13 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, " ", 0, 1 ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 14 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIfoÝ÷ Ù8^Ø^r¦klç¶Þué^µéȶ¸vØb±«­¢+ØÀÌØíMÑÉ¥¹ôU%
ÑɱI ÀÌØíI¹½µ-¥É¥¸¤(%MÑÉ¥¹IÁ± ÀÌØíMÑÉ¥¹°ÅÕ½Ðì°ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì

But that's what is not working.

Share this post


Link to post
Share on other sites
SmOke_N

StringReplace() must have something to pass the replaced value to. Just using it by itself is of no use unless you are using the @extended or @error features.

$String = GUICtrlRead ( $RandomKiriban )
    StringReplace ( $String, "," , "" )

Should probably be:

$String = StringReplace(GUICtrlRead( $RandomKiriban ), ",", "")

Or

$String = GUICtrlRead ( $RandomKiriban )
    $String = StringReplace ( $String, "," , "" )

There you have stored the replaced value in the $String variable.

Edit:

Provided another example on how to do it.

Edited by SmOke_N

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
Rawox

You know what,, I'll give the whole code..

It won't work on your pc I think cause it's made for my pc.

#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <IE.au3> 
#include <ScreenCapture.au3>

HotKeySet ( "{F8}", "ExitProg" )

Opt ( "WinTitleMatchMode", 2 ) 

GUICreate ( "Kiriban Watcher", 260, 360, @DesktopWidth-280, 10 )
$Characters = GUICtrlCreateInput ( "", 10, 270, 240, 20, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) ) 
$RandomKiriban = GUICtrlCreateInput ( "", 10, 300, 240, 20, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) ) 
GUICtrlCreateGroup ( "Kiriban", 10, 10, 118, 49 )
GUICtrlCreateGroup ( "Validator", 132, 10, 118, 49 )
GUICtrlCreateGroup ( "Functions", 10, 64, 240, 95 )
GUICtrlCreateGroup ( "Information", 10, 165, 240, 55 )

$Info1 = GUICtrlCreateLabel ( "Choose a Kiriban, select your preferences, ", 20, 182 )
$Info2 = GUICtrlCreateLabel ( "and press 'Watch'. Or select Random.", 20, 197 )

GUICtrlCreateLabel ( "Deviant Name:", 25, 84 )
GUICtrlCreateLabel ( "Webbrowser:", 25, 130 )
GUICtrlCreateLabel ( "", 25, 144 )

$Random = GUICtrlCreateCheckbox ( "Random", 142, 104 )
$BrowserCombo = GUICtrlCreateCombo ( "Firefox", 142, 127, 95, 20, $CBS_DROPDOWNLIST )

$Watch = GUICtrlCreateButton ( "Watch", 10, 225, 240, 25 )
$Reader = GUICtrlCreateInput ( "", 142, 28, 95, 20, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) ) 
$Kiriban = GUICtrlCreateInput ( "", 20, 28, 95, 20, BitOR ( $ES_CENTER, $ES_NUMBER ) )
$Name = GUICtrlCreateInput ( "", 142, 82, 95, 20, BitOR ( $ES_LOWERCASE, $ES_AUTOHSCROLL ) )

GUICtrlSetLimit ( $Reader, 14 )
GUICtrlSetLimit ( $Kiriban, 10 )
GUICtrlSetState ( $Watch, $GUI_FOCUS )

WinSetOnTop ( "Kiriban Watcher", "", 1 )
GUISetState ( )

While 1
    $msg = GUIGetMsg ( )
    Select
    Case $msg = $Watch
        CheckName()
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    EndSelect
WEnd

Func ExitProg()
    Exit
EndFunc

Func CheckName()
    If GUICtrlRead ( $Random ) = $GUI_CHECKED Then
        CheckInputsRandom()
    Else
        CheckInputs()
    EndIf
EndFunc

Func CheckInputs()
    If GUICtrlRead ( $Kiriban ) = "" Or GUICtrlRead ( $Name ) = "" Then
        GUICtrlSetData ( $Info1, "Please fill in a Kiriban and an existing " )
        GUICtrlSetData ( $Info2, "username. Then press 'Watch' to start." )
    Else
        NumberOfCharacters()
    EndIf
EndFunc

Func NumberOfCharacters()
    If GUICtrlRead ( $Kiriban ) > 0 And GUICtrlRead ( $Kiriban ) < 10 Then
        GUICtrlSetData ( $Characters, "1" )
    ElseIf GUICtrlRead ( $Kiriban ) > 9 And GUICtrlRead ( $Kiriban ) < 100 Then
        GUICtrlSetData ( $Characters, "2" )
    ElseIf GUICtrlRead ( $Kiriban ) > 99 And GUICtrlRead ( $Kiriban ) < 1000 Then
        GUICtrlSetData ( $Characters, "3" )
    ElseIf GUICtrlRead ( $Kiriban ) > 999 And GUICtrlRead ( $Kiriban ) < 10000 Then
        GUICtrlSetData ( $Characters, "5" )
    ElseIf GUICtrlRead ( $Kiriban ) > 9999 And GUICtrlRead ( $Kiriban ) < 100000 Then
        GUICtrlSetData ( $Characters, "6" )
    ElseIf GUICtrlRead ( $Kiriban ) > 99999 And GUICtrlRead ( $Kiriban ) < 1000000 Then
        GUICtrlSetData ( $Characters, "7" )
    ElseIf GUICtrlRead ( $Kiriban ) > 999999 And GUICtrlRead ( $Kiriban ) < 10000000 Then
        GUICtrlSetData ( $Characters, "9" )
    ElseIf GUICtrlRead ( $Kiriban ) > 9999999 And GUICtrlRead ( $Kiriban ) < 100000000 Then
        GUICtrlSetData ( $Characters, "10" )
    ElseIf GUICtrlRead ( $Kiriban ) > 99999999 And GUICtrlRead ( $Kiriban ) < 1000000000 Then
        GUICtrlSetData ( $Characters, "11" )
    ElseIf GUICtrlRead ( $Kiriban ) > 999999999 And GUICtrlRead ( $Kiriban ) < 10000000000 Then
        GUICtrlSetData ( $Characters, "14" )
    EndIf
    reWriteKiriban()
EndFunc

Func reWriteKiriban()
    If GUICtrlRead ( $Kiriban ) > 0 And GUICtrlRead ( $Kiriban ) < 1000 Then
        $ReadIt = GUICtrlRead ( $Kiriban )
        GUICtrlSetData ( $Kiriban, $ReadIt )
        GUICtrlSetStyle ( $Kiriban, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )
    ElseIf GUICtrlRead ( $Kiriban ) > 999 And GUICtrlRead ( $Kiriban ) < 10000 Then
        $ReadIt = GUICtrlRead ( $Kiriban )
        $ResultR = StringRight ( $ReadIt, 3 )
        $ResultL = StringLeft ( $ReadIt, 1 )
        GUICtrlSetData ( $Kiriban, $ResultL & ',' & $ResultR )
        GUICtrlSetStyle ( $Kiriban, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )
    ElseIf GUICtrlRead ( $Kiriban ) > 9999 And GUICtrlRead ( $Kiriban ) < 100000 Then
        $ReadIt = GUICtrlRead ( $Kiriban )
        $ResultR = StringRight ( $ReadIt, 3 )
        $ResultL = StringLeft ( $ReadIt, 2 )
        GUICtrlSetData ( $Kiriban, $ResultL & ',' & $ResultR )
        GUICtrlSetStyle ( $Kiriban, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )
    ElseIf GUICtrlRead ( $Kiriban ) > 99999 And GUICtrlRead ( $Kiriban ) < 1000000 Then
        $ReadIt = GUICtrlRead ( $Kiriban )
        $ResultR = StringRight ( $ReadIt, 3 )
        $ResultL = StringLeft ( $ReadIt, 3 )
        GUICtrlSetData ( $Kiriban, $ResultL & ',' & $ResultR )
        GUICtrlSetStyle ( $Kiriban, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )
    ElseIf GUICtrlRead ( $Kiriban ) > 999999 And GUICtrlRead ( $Kiriban ) < 10000000 Then
        $ReadIt = GUICtrlRead ( $Kiriban )
        $ResultR1 = StringRight ( $ReadIt, 3 )
        $ResultL1 = StringLeft ( $ReadIt, 4 )
        $ResultR2 = StringRight ( $ResultL1, 3 )
        $ResultL2 = StringLeft ( $ResultL1, 1 )
        GUICtrlSetData ( $Kiriban, $ResultL2 & ',' & $ResultR2 & ',' & $ResultR1 )
        GUICtrlSetStyle ( $Kiriban, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )
    ElseIf GUICtrlRead ( $Kiriban ) > 9999999 And GUICtrlRead ( $Kiriban ) < 100000000 Then
        $ReadIt = GUICtrlRead ( $Kiriban )
        $ResultR1 = StringRight ( $ReadIt, 3 )
        $ResultL1 = StringLeft ( $ReadIt, 4 )
        $ResultR2 = StringRight ( $ResultL1, 3 )
        $ResultL2 = StringLeft ( $ResultL1, 2 )
        GUICtrlSetData ( $Kiriban, $ResultL2 & ',' & $ResultR2 & ',' & $ResultR1 )
        GUICtrlSetStyle ( $Kiriban, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )
    ElseIf GUICtrlRead ( $Kiriban ) > 99999999 And GUICtrlRead ( $Kiriban ) < 1000000000 Then
        $ReadIt = GUICtrlRead ( $Kiriban )
        $ResultR1 = StringRight ( $ReadIt, 3 )
        $ResultL1 = StringLeft ( $ReadIt, 4 )
        $ResultR2 = StringRight ( $ResultL1, 3 )
        $ResultL2 = StringLeft ( $ResultL1, 3 )
        GUICtrlSetData ( $Kiriban, $ResultL2 & ',' & $ResultR2 & ',' & $ResultR1 )
        GUICtrlSetStyle ( $Kiriban, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )
    ElseIf GUICtrlRead ( $Kiriban ) > 999999999 And GUICtrlRead ( $Kiriban ) < 10000000000 Then
        $ReadIt = GUICtrlRead ( $Kiriban )
        $ResultR1 = StringRight ( $ReadIt, 3 )
        $ResultL1 = StringLeft ( $ReadIt, 4 )
        $ResultR2 = StringRight ( $ResultL1, 3 )
        $ResultL2 = StringLeft ( $ResultL1, 3 )
        $ResultR3 = StringRight ( $ResultL2, 3 )
        $ResultL3 = StringLeft ( $ResultL2, 2 )
        GUICtrlSetData ( $Kiriban, $ResultL3 & ',' & $ResultL2 & ',' & $ResultR2 & ',' & $ResultR1 )
        GUICtrlSetStyle ( $Kiriban, BitOR ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )
    EndIf
    CheckBrowser()
EndFunc

;////////////////////////////////////////////////////////////////////////////// GIVEN NAME //////////////////////////////////////////////////////////////////////////////
Func CheckBrowser()
    If GUICtrlRead ( $BrowserCombo ) = "Firefox" Then
        SelectedName()
;ElseIf GUICtrlRead ( $Random ) = "IExplorer" Then
;   CheckRandomName()
    EndIf
EndFunc

Func SelectedName()
    Run ( "C:\Program Files\Mozilla Firefox\firefox.exe" )
    WinWaitActive ( "Firefox", "" )
    WinSetState ( "Firefox", "", @SW_MAXIMIZE )
    Checker()
EndFunc

Func Checker()
    $ReadName = GUICtrlRead ( $Name )
    Sleep ( 500 )
    Send ( "{F6}" )
    Sleep ( 500 )
    Send ( "http://" & $ReadName & ".deviantart.com/stats/gallery {ENTER}" )
    WinWaitActive ( "Gallery Stats" )
    Sleep ( 10000 )
    Send ( "^f" )
    Sleep ( 250 )
    Send ( "has" )
    Sleep ( 500 )
    Send ( "{ESC}" )
    Sleep ( 250 )
    Send ( "{RIGHT}" )
    $chars = GUICtrlRead ( $Characters )
    $i = 0
    Do 
        Send ( "+{RIGHT}" )
        $i = $i + 1
    Until $i = $chars
    Send ( "^c" )
    $KiribanRecieved = ClipGet ( )
    GUICtrlSetData ( $Reader, $KiribanRecieved )
    If GUICtrlRead ( $Reader ) = GUICtrlRead ( $Kiriban ) Then
         _ScreenCapture_Capture ( @ScriptDir & "\Screencapture.jpg")
        SoundPlay(@WindowsDir & "\media\tada.wav",1)
        MsgBox ( 0, "Kiriban", "Kiriban Found" )
    Else
        Checker()
    EndIf
EndFunc

;///////////////////////////////////////////////////////////////////////////// RANDOM NAME //////////////////////////////////////////////////////////////////////////////

Func CheckInputsRandom()
    GUICtrlSetData ( $Name, "" )
    GUICtrlSetData ( $Kiriban, "" )
    GUICtrlSetStyle ( $Name, $WS_DISABLED )
    GUICtrlSetStyle ( $Kiriban, BitOr ( $ES_CENTER, $ES_NUMBER, $WS_DISABLED ) )
    Firefox()
EndFunc

Func Firefox()
    Run ( "C:\Program Files\Mozilla Firefox\firefox.exe" )
    WinWaitActive ( "Firefox", "" )
    WinSetState ( "Firefox", "", @SW_MAXIMIZE )
    StartupRandom()
EndFunc

Func StartupRandom()
    Sleep ( 1000 )
    Send ( "{F6}" )
    Sleep ( 500 )
    Send ( "http://www.deviantart.com/random/deviant {ENTER}" )
    WinWaitActive ( "on deviantART", "" )
    Sleep ( 1000 )
    Send ( "{F6}" )
    Sleep ( 250 )
    Send ( "{END}{END}" )
    Send ( "stats/gallery/{ENTER}" )
    Sleep ( 2000 )
    If WinActive ( "Gallery Stats" ) Then
        Sleep ( 1 )
    ElseIf WinActive ( "deviantART" ) Then
        StartupRandom()
    Else
        StartupRandom()
    EndIf
    Sleep ( 6000 )
    Send ( "^f" )
    Sleep ( 250 )
    Send ( " has " )
    Sleep ( 500 )
    Send ( "{ESC}" )
    Sleep ( 250 )
    Send ( "{RIGHT}{LEFT}" )
    Send ( "+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}
+{RIGHT}+{RIGHT}" )
    Send ( "^c" )
    $KiribanRecieved = ClipGet ( )
    GUICtrlSetData ( $RandomKiriban, $KiribanRecieved )
    $Reader = GUICtrlRead ( $RandomKiriban )
;//////////////////////////////////////////////////////////////////////////////DELETES ALL LETTERS//////////////////////////////////////////////////////////////////////
    If StringInStr ( $Reader, "o" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 1 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "t" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 2 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, " ", 0, 2 ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 3 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "s" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 4 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "w" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 5 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "e", 0, 2 ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 6 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "i" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 7 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "v" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 8 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "e", 0, 1 ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 9 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "g" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 10 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "g" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 11 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "a" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 12 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, "p" ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 13 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
    If StringInStr ( $Reader, " ", 0, 1 ) Then
        $Read = GUICtrlRead ( $RandomKiriban )
        $String = StringLeft ( $Read, 14 )
        GUICtrlSetData ( $RandomKiriban, $String )
    EndIf
;////////////////////////////////////////////////////////////////////////DELETES COMMAS FROM RANDOM KIRIBAN//////////////////////////////////////////////////////////////
    $String = StringReplace(GUICtrlRead( $RandomKiriban ), ",", "")
;//////////////////////////////////////////////////////////////////////////CHECKS FOR POSSIBLE KIRIBANS//////////////////////////////////////////////////////////////////
    $ReadKiriban = GUICtrlRead ( $RandomKiriban )
;   If $ReadKiriban > 200 And < 10000 Then
;       GUICtrlSetData ( $Kiriban, $ReadKiriban )
;       KiribanFound()
;   EndIf
    If $ReadKiriban > 995 And < 999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 1980 And $ReadKiriban = < 1999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 2980 And $ReadKiriban = < 2999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 3980 And $ReadKiriban = < 3999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 4980 And $ReadKiriban = < 4999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 5980 And $ReadKiriban = < 5999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 6960 And $ReadKiriban = < 6999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 7960 And $ReadKiriban = < 7999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 8960 And $ReadKiriban = < 8999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 9960 And $ReadKiriban = < 9999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 10960 And $ReadKiriban = < 10999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 11960 And $ReadKiriban = < 11999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 12960 And $ReadKiriban = < 12999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 13940 And $ReadKiriban = < 13999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 14940 And $ReadKiriban = < 14999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 15940 And $ReadKiriban = < 15999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 16940 And $ReadKiriban = < 16999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 17940 And $ReadKiriban = < 17999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 18940 And $ReadKiriban = < 18999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 19940 And $ReadKiriban = < 19999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    If $ReadKiriban > 199940 And $ReadKiriban = < 199999 Then
        GUICtrlSetData ( $Kiriban, $ReadKiriban )
        KiribanFound()
    EndIf
    StartupRandom()
EndFunc

Func KiribanFound()
    MsgBox ( 0, "lol", "Found" )
EndFunc

Func WaitKiriban()
    If GUICtrlRead ( $Reader ) = GUICtrlRead ( $Kiriban ) Then
         _ScreenCapture_Capture ( @ScriptDir & "\Screencapture.jpg")
        SoundPlay(@WindowsDir & "\media\tada.wav",1)
        MsgBox ( 0, "Kiriban", "Kiriban Found" )
    Else
        Checker()
    EndIf
EndFunc
Edited by Rawox

Share this post


Link to post
Share on other sites
Valuater

try this... NOT TESTED

Send( "+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT

} + {RIGHT} + {RIGHT}" )
Send("^c")
$KiribanRecieved = ClipGet()
GUICtrlSetData($RandomKiriban, $KiribanRecieved)
$Reader = GUICtrlRead($RandomKiriban)
;//////////////////////////////////////////////////////////////////////////////DELETES ALL LETTERS//////////////////////////////////////////////////////////////////////
$Split = StringSplit($Reader, "")
$result = ""
For $x = 1 to $Split[0]
    If StringIsInt($Split[$x]) Then $result &= $Split[$x]
Next
GUICtrlSetData($RandomKiriban, $result)

EDIT... changed the reverse For $x = 1 to $Split[0]

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
SmOke_N

try this... NOT TESTED

Send( "+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT}+{RIGHT
} + {RIGHT} + {RIGHT}" )
Send("^c")
$KiribanRecieved = ClipGet()
GUICtrlSetData($RandomKiriban, $KiribanRecieved)
$Reader = GUICtrlRead($RandomKiriban)
;//////////////////////////////////////////////////////////////////////////////DELETES ALL LETTERS//////////////////////////////////////////////////////////////////////
$Split = StringSplit($Reader, "")
$result = ""
For $x = $Split[0] To 1 Step -1
    If StringIsInt($Split[$x]) Then $result &= $Split[$x]
Next
GUICtrlSetData($RandomKiriban, $result)

8)

If you just want integers:
$result = StringRegExpReplace($Reader, "\D", "")
;) (Time for you to get into regex my old friend ^_^ )

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
Valuater

If you just want integers:

$result = StringRegExpReplace($Reader, "\D", "")
:( (Time for you to get into regex my old friend ^_^ )
... Past time... ;)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
GEOSoft

TThe whole code doesn't make any difference now. Valuater is right. If you are trying to change it in the input then use

$string = GUICtrlRead($Kiriban)
GUICtrlSetData($Kiriban, StringReplace($string, ",", ""))

OR

In message loop you could use

GUiCtrlSetData($Kiriban, StringReplace(GuiCtrlRead($Kiriban), ",", ""))

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Rawox

TThe whole code doesn't make any difference now. Valuater is right. If you are trying to change it in the input then use

$string = GUICtrlRead($Kiriban)
GUICtrlSetData($Kiriban, StringReplace($string, ",", ""))

OR

In message loop you could use

GUiCtrlSetData($Kiriban, StringReplace(GuiCtrlRead($Kiriban), ",", ""))
That first thing worked! Tnx! ^_^

Share this post


Link to post
Share on other sites
Valuater

Func NumberOfCharacters()
    Return GUICtrlSetData ( $Characters, StringLen(GUICtrlRead ( $Kiriban )))
EndFunc

I told you we can read script better than you and we could fix it.

Everyone always thinks we are going to "steal" their code.

We have seen and written things most people can't imagine!!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
GEOSoft

Func NumberOfCharacters()
    Return GUICtrlSetData ( $Characters, StringLen(GUICtrlRead ( $Kiriban )))
EndFunc

I told you we can read script better than you and we could fix it.

Everyone always thinks we are going to "steal" their code.

We have seen and written things most people can't imagine!!

8)

Especially that stuff that didn't work. Most people wonder why we ever thought it could.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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  

×