Jump to content

Help with stuff


themax90
 Share

Recommended Posts

I want to write into a file and then check the file for special characters. Like if there is a ! then set $compound = $compound & "{shiftdown}1{shiftup}" Then controlsend $compond. Is there a special character analyzer already built or how can I search a file after reading it for a special char?

Can you alter this code to make it work?

#include <GuiConstants.au3>
Dim $WS_OVERLAPPEDWINDOW = 0xCF0000, $WS_VISIBLE = 0x10000000, $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("MyGUI", 392, 226,(@DesktopWidth-392)/2, (@DesktopHeight-226)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Edit_1 = GuiCtrlCreateEdit("Edit1", 10, 20, 370, 160)
$Button_2 = GuiCtrlCreateButton("Button2", 50, 200, 120, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
      Exit
   EndIf
   If $msg = 4 Then
      $info = GUICtrlRead($edit_1)
      FileWrite("test", $info)
      $info = FileRead ( "test", 300)
      If $info = "!" Then
         $compound = $compund & "{SHIFTDOWN}1{SHIFTUP}"
      EndIf
      Run("cmd.exe")
      sleep(1000)
      ControlSend("C:\WINDOWS\System32\cmd.exe", "", "", $compound)
      EndIf
WEnd
Exit

Thanks

Edited by Agent Smith
Link to comment
Share on other sites

  • Developers

$chr = "!"
$FName = "YourFile.txt" 
If StringInStr(Fileread($FName,FileGetSize($FName)),$chr) Then
  ; whatever you want to do when character is found 
EndIf

Edit: syntax error

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

do you know how to do that then for every ! replace it with {shiftdown}1{shiftup} ? and rewrite it to that file.

like take in the string of $info and find all !'s then change all the !'s to {shiftdown}1{shiftup} and save it the variable $info with the original string of info only the !'s to {shiftdown}1{shiftup} or back to a file. Possible?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...