Vindicator209 Posted January 10, 2007 Posted January 10, 2007 (edited) Hey, sorry my title was so uninformative, but I really dont even know what my problem here is! XD Pretty much, my script was supposed to type out thins that are set in an .ini file, but for some reason, it doesnt stop typing it, and it only types the first word before a space.... thanks for even reading XD My script: expandcollapse popupHotKeySet("{up}","up") HotKeySet("{down}","down") HotKeySet("{left}","left") HotKeySet("{right}","right") HotKeySet("{home}","menu") HotKeySet("1","f1") HotKeySet("2","f2") HotKeySet("3","f3") HotKeySet("4","f4") HotKeySet("5","f5") HotKeySet("6","f6") HotKeySet("7","f7") HotKeySet("8","f8") HotKeySet("9","f9") HotKeySet("0","f0") $1a=StringTrimLeft(FileReadLine("HotKeySet.ini",2),6) $2a=StringTrimLeft(FileReadLine("HotKeySet.ini",3),6) $3a=StringTrimLeft(FileReadLine("HotKeySet.ini",4),6) $4a=StringTrimLeft(FileReadLine("HotKeySet.ini",5),6) $5a=StringTrimLeft(FileReadLine("HotKeySet.ini",6),6) $6a=StringTrimLeft(FileReadLine("HotKeySet.ini",7),6) $7a=StringTrimLeft(FileReadLine("HotKeySet.ini",8),6) $8a=StringTrimLeft(FileReadLine("HotKeySet.ini",9),6) $9a=StringTrimLeft(FileReadLine("HotKeySet.ini",10),6) $0a=StringTrimLeft(FileReadLine("HotKeySet.ini",11),6) While 1 Sleep(1000) WEnd Func f1() Send($1a) EndFunc Func f2() Send($2a) EndFunc Func f3() Send($3a) EndFunc Func f4() Send($4a) EndFunc Func f5() Send($5a) EndFunc Func f6() Send($6a) EndFunc Func f7() Send($7a) EndFunc Func f8() Send($8a) EndFunc Func f9() Send($9a) EndFunc Func f0() Send($0a) EndFunc Func up() Send("up") Send("{enter}") EndFunc Func down() Send("down") Send("{enter}") EndFunc Func left() Send("left") Send("{enter}") EndFunc Func right() Send("right") Send("{enter}") EndFunc Func menu() #include <GuiConstants.au3> $menu=GuiCreate("Menu", 183, 155,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Button_1 = GuiCtrlCreateButton("Set Hotkeys", 10, 10, 160, 40) $Button_2 = GuiCtrlCreateButton("About", 10, 60, 160, 40) $Button_3 = GuiCtrlCreateButton("Exit", 10, 110, 160, 30) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $Button_1 #include <GuiConstants.au3> $1a=StringTrimLeft(FileReadLine("HotKeySet.ini",2),6) $2a=StringTrimLeft(FileReadLine("HotKeySet.ini",3),6) $3a=StringTrimLeft(FileReadLine("HotKeySet.ini",4),6) $4a=StringTrimLeft(FileReadLine("HotKeySet.ini",5),6) $5a=StringTrimLeft(FileReadLine("HotKeySet.ini",6),6) $6a=StringTrimLeft(FileReadLine("HotKeySet.ini",7),6) $7a=StringTrimLeft(FileReadLine("HotKeySet.ini",8),6) $8a=StringTrimLeft(FileReadLine("HotKeySet.ini",9),6) $9a=StringTrimLeft(FileReadLine("HotKeySet.ini",10),6) $0a=StringTrimLeft(FileReadLine("HotKeySet.ini",11),6) $settings=GuiCreate("Settings", 160, 368,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput($1a, 30, 30, 100, 20) $Input_2 = GuiCtrlCreateInput($2a, 30, 60, 100, 20) $Input_3 = GuiCtrlCreateInput($3a, 30, 90, 100, 20) $Input_4 = GuiCtrlCreateInput($4a, 30, 120, 100, 20) $Input_5 = GuiCtrlCreateInput($5a, 30, 150, 100, 20) $Input_6 = GuiCtrlCreateInput($6a, 30, 180, 100, 20) $Input_7 = GuiCtrlCreateInput($7a, 30, 210, 100, 20) $Input_8 = GuiCtrlCreateInput($8a, 30, 240, 100, 20) $Input_9 = GuiCtrlCreateInput($9a, 30, 270, 100, 20) $Input_10 = GuiCtrlCreateInput($0a, 30, 300, 100, 20) $Group_11 = GuiCtrlCreateGroup("Hot Keys", 10, 0, 140, 360) $Button_12 = GuiCtrlCreateButton("SAVE", 30, 330, 100, 20) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $Button_12 $1=GUICtrlRead($Input_1) $2=GUICtrlRead($Input_2) $3=GUICtrlRead($Input_3) $4=GUICtrlRead($Input_4) $5=GUICtrlRead($Input_5) $6=GUICtrlRead($Input_6) $7=GUICtrlRead($Input_7) $8=GUICtrlRead($Input_8) $9=GUICtrlRead($Input_9) $0=GUICtrlRead($Input_10) FileDelete("HotKeySet.ini") FileWrite("HotKeySet.ini","[KEY] [MACRO]") FileWriteLine("HotKeySet.ini",@CRLF & "Key 1=" & $1) FileWriteLine("HotKeySet.ini","Key 2=" & $2) FileWriteLine("HotKeySet.ini","Key 3=" & $3) FileWriteLine("HotKeySet.ini","Key 4=" & $4) FileWriteLine("HotKeySet.ini","Key 5=" & $5) FileWriteLine("HotKeySet.ini","Key 6=" & $6) FileWriteLine("HotKeySet.ini","Key 7=" & $7) FileWriteLine("HotKeySet.ini","Key 8=" & $8) FileWriteLine("HotKeySet.ini","Key 9=" & $9) FileWriteLine("HotKeySet.ini","Key 0=" & $0) FileWriteLine("HotKeySet.ini","[End Hot Keys]") FileWriteLine("HotKeySet.ini","[The Hot keys are numbers 1-0 at the top of your keyboard]") FileWriteLine("HotKeySet.ini","[If you wish for the program to ENTER what you typed, type {enter} after your macro]") Case $msg = $GUI_EVENT_CLOSE GUIDelete($settings) ExitLoop Case Else ;;; EndSelect WEnd Case $msg = $Button_2 MsgBox(0,"About","") Case $msg = $Button_3 Exit Case $msg = $GUI_EVENT_CLOSE GUIDelete($menu) ExitLoop Case Else ;;; EndSelect WEnd EndFunc The INI File: [KEY] [MACRO] Key 1=Key 1 Key 2=Key 2 Key 3=Key 3 Key 4=Key 4 Key 5=Key 5 Key 6=Key 6 Key 7=Key 7 Key 8=Key 8 Key 9=Key 9 Key 0=Key 0 [End Hot Keys] [The Hot keys are numbers 1-0 at the top of your keyboard] [If you wish for the program to ENTER what you typed, type {enter} after your macro] Also, how do I have a script copy something to the clip board without having the user to Highlight> Copy, in fact, how would I do it with text that doesent exist? (im makeing something that creates html codes for MySpace.com XD) Thanks again! Edited January 10, 2007 by MethodZero [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]
Paulie Posted January 11, 2007 Posted January 11, 2007 You use an .INI file, but are using the "FileRead/WriteLine" with it. Why not use "INI*" functions? BTW: your INI is formatted wrong, i don't think you can have 2 section titles in one line I think its supposed to look like this: [SectionName] Key1=Value Key2=Value
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now