Sign in to follow this  
Followers 0
Velnes

creating edit box without default focus on its alrdy added text

6 posts in this topic

hey im creating this cmd.. easy cmd ... (just coding to spend time on sumtin... and get my coding skills up ;D )

and so there is a prob .. i dunno how to get the focus off of the text .. its always marked by default when u run the thing...and i just want the cmd to be ready for typing into it without pressing mouse on last line to do typing...

#cs ----------------------------------------------------------------------------

 AutoIt Version: 1.1.0.0
 Author:         Tomas Griksas - Paulius

 Script Function:
    cmd command motoring document
    fast way to open any program on your computer

#ce ----------------------------------------------------------------------------

#include <IE.au3>
#include <INet.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#Include <WinAPI.au3>
#include <StaticConstants.au3>
#Include <Constants.au3>
#include <SendMessage.au3>
#include <GuiButton.au3>
#include <File.au3>
#include <ProgressConstants.au3>
#include <GuiSlider.au3>
#include <Date.au3>
#include <Timers.au3>
#include <GuiStatusBar.au3>
#include <ClipBoard.au3>
#Include <String.au3>
#include <TreeViewConstants.au3>
#include <Misc.au3>
#include <ClipBoard.au3>
#include <EditConstants.au3>
#Include <String.au3>
#include <GuiEdit.au3>
#include <Sound.au3>
#NoTrayIcon

HotKeySet("{ENTER}", "CRLF")

$CMD = GUICreate(@UserName & " : " & @ScriptDir & "\easy cmd.exe", 600, 250) ;create main window-the engine
GUISetBkColor(0x000000) ;set the baground color to black so it looks readeble with white letters on it

;====script functionalitty starting======================
$DATA_EDITOR = GUICtrlCreateEdit(@OSVersion & "    " & "Current Resolution:" &  @DesktopWidth & "x" & @DesktopHeight & @CRLF  &  @CPUArch & "-bit" & @CRLF, 0, 0, 600, 250)
GUICtrlSetBkColor(-1,0x000000)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont($DATA_EDITOR, 8.5, -1,-1,"Arial Bold")









GUISetState() ;set teh state of gui to 'show'


;engine running here=========================================================
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE;=====event to close on ESC or exit button===
            exit 1
    EndSwitch
WEnd
;engine running here=========================================================

Func CRLF()
    If WinActive($CMD, $CMD) Then
    ;_GUICtrlEdit_SetText($DATA_EDITOR, _GUICtrlEdit_GetText($DATA_EDITOR) & _GUICtrlEdit_GetLineCount($DATA_EDITOR) &  @CRLF)
    _FILE_ENGINE()
    Else
     Return
    EndIf
EndFunc

Func _FILE_ENGINE()
    
    FileWrite(@TempDir & "easy cmd.config", GUICtrlRead($DATA_EDITOR))
    _COMMAND_LIST()
EndFunc


Func _COMMAND_LIST()
    ;======command list
    $HELP = "help"
    $OS_VERSION = "os//get info"
    $EXIT = "exit"
    ;=======command list ends here
    If FileReadLine(@TempDir & "easy cmd.config", -1) = $HELP then 
        _GUICtrlEdit_InsertText($DATA_EDITOR, @CRLF & "Help Commands List:" & @CRLF & "help = commands list" & @CRLF & "os//get info = your current OS" )
    Else
        _GUICtrlEdit_InsertText($DATA_EDITOR, @CRLF)
    EndIf
    If FileReadLine(@TempDir & "easy cmd.config", -1) = $OS_VERSION then 
        _GUICtrlEdit_InsertText($DATA_EDITOR, @CRLF & @OSVersion &" "& @OSArch & "-bit" & @CRLF)
    Else
        _GUICtrlEdit_InsertText($DATA_EDITOR, @CRLF)
    EndIf
    If FileReadLine(@TempDir & "easy cmd.config", -1) = $EXIT then 
        Exit 1
    Else
        _GUICtrlEdit_InsertText($DATA_EDITOR, @CRLF)
    EndIf
    _CLEAR()
EndFunc

Func _CLEAR()
    FileDelete(@TempDir & "easy cmd.config")
EndFunc

Share this post


Link to post
Share on other sites



aw nice :) worked like a charm.

one other thing while i was waiting for this answer i got another problem...

u know the way u write like the data text.. not comment but the text for data for guictrl edit here

so instead of writing in the script all the way to the right side how do u manage to another line but with same thing on same var...like this sumtin of my idea to explain here:

$Var = "text here for example1 /
text also here ..for same $var but on other line /
instead of going all the way to right /
side"

i hope u get the idea im explaining ;) ive seen this thing somewhere but rly cant remember

Share this post


Link to post
Share on other sites

explaining you call that? :)

In case you want variable with line breaks:

$Var = "line 1" _
& @CRLF & "line 2" _
& @CRLF & "line 3"

Share this post


Link to post
Share on other sites

lol ye i hadn't any ideahow to explain that :idiot: but yes the _ thing worked

thnk you both for helping me :)

ill continue going on with the thing now :idiot:;)

Share this post


Link to post
Share on other sites

lol ye i hadn't any ideahow to explain that :idiot: but yes the _ thing worked

thnk you both for helping me :)

ill continue going on with the thing now :idiot:;)

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