maqleod Posted September 6, 2007 Share Posted September 6, 2007 (edited) ok, so I am stuck in a couple places on this script (sorta my own version of a combo of SimplePad and AIPad) anyway here's what I can't figure out: 1) In the SaveAs() function, instead of using the If, elseif, else structure, I'd rather find a way to make the script detect what filter was used and apply that extension itself, checking of course if the user added it and making the correction (to avoid test.txt.txt) 2)I can't get the toggling of the word wrap function to work. Those styles that I add, if used in the GuiCtrlCreateEdit function, produce an edit control with word wrapping, however when added later with the GuiSetStyle function, they do not. 3)if I compile the script and run it from command line (fullpath.exe fullpath.txt) I get an error that says: Line -1: Error: Subscript used with non-Array variable. I can't figure out what is causing that error. Everything you need to run/compile the script are in the zip file. The code is posted below, any help would be greatly appreciated. expandcollapse popup;Securepad ;v.0.1 ;written by MaQleod #include <GuiConstants.au3> #include <GuiEdit.au3> #include <String.au3> #include <Misc.au3> #include <File.au3> #include <TextEdit.au3> FileSetAttrib("data.ini","+SH") $pass = IniReadSection("data.ini", "Admin") if $pass[1][1] <> "" then $password = InputBox("Password Required","Please enter your password","","*") if $password <> _StringEncrypt(0,$pass[1][1],"maqleod",5) then MsgBox(64, "Error", "You do not have sufficient access to open this application.") Exit endif endif Dim $voice = ObjCreate("Sapi.SpVoice") HotKeySet("^n", "New") ; Control+N HotKeySet("^o", "Open") ; Control+O HotKeySet("^s", "Save") ; Control+S HotKeySet("^+s", "SaveAs") ; Control+Shift+S HotKeySet("^p", "Print") ; Control+P HotKeySet("^t", "SpeakText") ; Control+T HotKeySet("^z", "Undo") ; Control+Z HotKeySet("^x", "Cut") ; Control+X HotKeySet("^c", "Copy") ; Control+C HotKeySet("^v", "Paste") ; Control+V HotKeySet("^a", "SelectAll") ; Control+A HotKeySet("^f", "Find") ; Control+F HotKeySet("{F3}", "FindNext") ; F3 $name = "Securepad" $version = "v.0.1" $parent = GUICreate($name,627,447,193,115) Opt("RunErrorsFatal", 0) $edit = GUICtrlCreateEdit("",0,0,625,425,-1,0) if $CmdLine[0] > 0 then $filetype = StringRight($CmdLine[1], 3) if $filetype = "spt" then $title = WinGetTitle($name,"") WinSetTitle($title,"",$name & " - " & $CmdLine[1] & "") $defile = FileRead($CmdLine[1]) $docde = "finnmacumhail" $decrypt = _StringEncrypt(0,$defile,$docde,3) GUICtrlSetData($edit,$decrypt) _GUICtrlEditEmptyUndoBuffer($edit) else $title = WinGetTitle($name,"") WinSetTitle($title,"",$name & " - " & $CmdLine[1] & "") $defile = FileRead($CmdLine[1]) GUICtrlSetData($edit,$defile) _GUICtrlEditEmptyUndoBuffer($edit) endif endif $fileopt = GUICtrlCreateMenu("&File") $open = GUICtrlCreateMenuItem("Open CTRL+O",$fileopt) $new = GUICtrlCreateMenuItem("New CTRL+N",$fileopt) $save = GUICtrlCreateMenuItem("Save CTRL+S",$fileopt) $saveas = GUICtrlCreateMenuItem("Save As CTRL+SHIFT+S",$fileopt) $print = GUICtrlCreateMenuItem("Print CTRL+P",$fileopt) GUICtrlCreateMenuItem("",$fileopt) $speak = GUICtrlCreateMenuItem("Speak Text CTRL+T",$fileopt) GUICtrlCreateMenuItem("",$fileopt) $exit = GUICtrlCreateMenuItem("Exit",$fileopt) $editopt = GUICtrlCreateMenu("&Edit") $undo = GUICtrlCreateMenuItem("Undo CTRL+Z",$editopt) GUICtrlCreateMenuItem("",$editopt) $cut = GUICtrlCreateMenuItem("Cut CTRL+X",$editopt) $copy = GUICtrlCreateMenuItem("Copy CTRL+C",$editopt) $paste = GUICtrlCreateMenuItem("Paste CTRL+V",$editopt) $selectall = GUICtrlCreateMenuItem("Select All CTRL+A",$editopt) GUICtrlCreateMenuItem("",$editopt) $find = GUICtrlCreateMenuItem("Find CTRL+F",$editopt) $findnext = GUICtrlCreateMenuItem("Find Next F3",$editopt) $formatopt = GUICtrlCreateMenu ("&Format") $wordwrap = GUICtrlCreateMenuitem ("Word Wrap",$formatopt) $wordwrapcheck = IniRead("data.ini","WordWrap","wrap","0") if $wordwrapcheck = "1" then GUICtrlSetState($wordwrap,$GUI_CHECKED) GUICtrlSetStyle($edit,$WS_VSCROLL,$ES_WANTRETURN+$ES_AUTOVSCROLL) elseif $wordwrapcheck <> "0" then GUICtrlSetState($wordwrap,$GUI_UNCHECKED) GUICtrlSetStyle($edit,$WS_VSCROLL+$WS_HSCROLL,$ES_WANTRETURN+$ES_AUTOVSCROLL+$ES_AUTOHSCROLL) endif $fontedit = GUICtrlCreateMenuitem ("Font",$formatopt) $configureopt = GUICtrlCreateMenu ("&Configure") $pass = GUICtrlCreateMenuitem ("Set/Change Password",$configureopt) $options = GUICtrlCreateMenuitem ("Optioins",$configureopt) $helpopt = GUICtrlCreateMenu("&About") $about = GUICtrlCreateMenuItem("About",$helpopt) $dummymenu = GUICtrlCreateDummy() $contextmenu = GUICtrlCreateContextMenu($dummymenu) $undocontext = GUICtrlCreateMenuItem("Undo",$contextmenu) GUICtrlCreateMenuItem("",$contextmenu) $cutcontext = GUICtrlCreateMenuItem("Cut",$contextmenu) $copycontext = GUICtrlCreateMenuItem("Copy",$contextmenu) $pastecontext = GUICtrlCreateMenuItem("Paste",$contextmenu) $selectallcontext = GUICtrlCreateMenuItem("Select All",$contextmenu) GUICtrlCreateMenuItem("",$contextmenu) $findcontext = GUICtrlCreateMenuItem("Find",$contextmenu) $findnextcontext = GUICtrlCreateMenuItem("Find Next",$contextmenu) GUISetState() Do $msg = GUIGetMsg() $CurInfo = GUIGetCursorInfo($parent) Select Case $CurInfo[3] = 1 And $CurInfo[4] = $Edit ShowMenu($parent, $contextmenu) EndSelect if $msg = $wordwrap then if BitAnd(GUICtrlRead($wordwrap),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($wordwrap,$GUI_UNCHECKED) IniWrite("data.ini","WordWrap","wrap","0") GUICtrlSetStyle($edit,$WS_VSCROLL+$WS_HSCROLL,$ES_WANTRETURN+$ES_AUTOVSCROLL+$ES_AUTOHSCROLL) else GUICtrlSetState($wordwrap,$GUI_CHECKED) IniWrite("data.ini","WordWrap","wrap","1") GUICtrlSetStyle($edit,$WS_VSCROLL,$ES_WANTRETURN+$ES_AUTOVSCROLL) ;GUICtrlSetStyle($edit,$ES_WANTRETURN+$WS_VSCROLL+$ES_AUTOVSCROLL) endif endif if $msg = $open then Open() endif if $msg = $new then New() IniWrite("data.ini","Font","font","Arial") IniWrite("data.ini","Font","size","10") IniWrite("data.ini","Font","style","Normal") endif if $msg = $save then Save() endif if $msg = $saveas then SaveAs() endif if $msg = $print then Print() endif if $msg = $speak then SpeakText() endif if $msg = $undo or $msg = $undocontext then Undo() endif if $msg = $cut or $msg = $cutcontext then Cut() endif if $msg = $copy or $msg = $copycontext then Copy() endif if $msg = $paste or $msg = $pastecontext then Paste() endif if $msg = $selectall or $msg = $selectallcontext then SelectAll() endif if $msg = $find or $msg = $findcontext then Find() endif if $msg = $findnext or $msg = $findnextcontext then FindNext() endif if $msg = $exit then ExitLoop endif if $msg = $options then $child4 = GUICreate("Options",220, 220,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) $replace = GuiCtrlCreateCheckbox("Replace Notepad in Shell",10,15,140,20) $okoption = GUICtrlCreateButton ("OK",35,170,75,25) $canceloption = GUICtrlCreateButton ("Cancel",125,170,75,25) GUISetState() Do $msg4 = GUIGetMsg() if $msg4= $okoption then ExitLoop endif if $msg4= $canceloption then ExitLoop endif Until $msg4 = $GUI_EVENT_CLOSE GUIDelete($child4) endif if $msg = $fontedit then $child3 = GUICreate("Font",320, 130,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) $defaultfont = IniRead("data.ini","Font","font","Arial") $defaultsize = IniRead("data.ini","Font","size","10") $defaultstyle = IniRead("data.ini","Font","style","Normal") $fontlist = _FontGetList(0) GuiCtrlCreateLabel("Choose a Font:",10,15,80,20) $fontselect = GuiCtrlCreateCombo("Arial",95,10,215,20) For $i = 1 to $fontlist[0] GuiCtrlSetData($fontselect,$fontlist[$i],$defaultfont) Next GuiCtrlCreateLabel("Font Size:",10,40,80,20) $fontsize = GuiCtrlCreateCombo("2",95,35,45,20) GuiCtrlSetData($fontsize,"4|5|6|7|8|9|10|11|12|14|16|18|20|22|24|26|28|30|32|36|48|72",$defaultsize) GuiCtrlCreateLabel("Font Style:",10,65,80,20) $fontstyle = GuiCtrlCreateCombo("Normal",95,60,75,20) GuiCtrlSetData($fontstyle,"Italic|Underline|Strike",$defaultstyle) $setfont = GuiCtrlCreateButton("Set Font",75,90,75,25) $cancelfont = GuiCtrlCreateButton("Cancel",155,90,75,25) GUISetState() Do $msg3 = GUIGetMsg() if $msg3 = $setfont then if GuiCtrlRead($fontstyle) = "Normal" then $attribute = 0 elseif GuiCtrlRead($fontstyle) = "Italic" then $attribute = 2 elseif GuiCtrlRead($fontstyle) = "Underline" then $attribute = 4 elseif GuiCtrlRead($fontstyle) = "Strike" then $attribute = 8 endif GUICtrlSetFont($edit,GuiCtrlRead($fontsize),400,$attribute,GuiCtrlRead($fontselect)) IniWrite("data.ini","Font","font",GuiCtrlRead($fontselect)) IniWrite("data.ini","Font","size",GuiCtrlRead($fontsize)) IniWrite("data.ini","Font","style",GuiCtrlRead($fontstyle)) ExitLoop endif if $msg3 = $cancelfont then ExitLoop endif Until $msg3 = $GUI_EVENT_CLOSE GUIDelete($child3) endif if $msg = $pass then $pass = IniReadSection("data.ini", "Admin") if $pass[1][1] = "" then $child2 = GUICreate("Set Admin Pass",250, 250,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) Opt("RunErrorsFatal", 0) GUICtrlCreateLabel ("You have not set an Admin Pass, please do so.", 45, 30, 150,30) GUICtrlCreateLabel ("Enter Password:", 25, 90, 50,30) $adminpass = GUICtrlCreateInput("", 105, 95, 75,20,$ES_PASSWORD) GUICtrlCreateLabel ("Re-enter Password:", 25, 120, 50,30) $adminpasscheck = GUICtrlCreateInput("", 105, 125, 75,20,$ES_PASSWORD) $passencrypt = GUICtrlCreateInput("", 105, 150, 75,20,$ES_PASSWORD) GUICtrlSetState(-1,$GUI_HIDE) $passok = GUICtrlCreateButton ("OK", 75, 190, 75,25) GUISetState() Do $msg2 = GUIGetMsg() if $msg2 = $passok then if (GUICtrlRead($adminpass)) = (GUICtrlRead($adminpasscheck)) then GuiCtrlSetData($passencrypt,_StringEncrypt(1,(GUICtrlRead($adminpass)),"maqleod",5)) IniWrite("data.ini", "Admin", "Password", (GUICtrlRead($passencrypt))) ExitLoop else MsgBox(64, "Error", "Passwords did not match, please re-enter passwords.") endif endif Until $msg2 = $GUI_EVENT_CLOSE GUIDelete($child2) else $child2 = GUICreate("Change Admin Pass",250, 250,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) Opt("RunErrorsFatal", 0) GUICtrlCreateLabel ("Old Password:", 25, 30, 50,30) $adminpassold = GUICtrlCreateInput("", 135, 30, 75,20,$ES_PASSWORD) GUICtrlCreateLabel ("New Password:", 25, 90, 50,30) $adminpass = GUICtrlCreateInput("", 135, 90, 75,20,$ES_PASSWORD) GUICtrlCreateLabel ("Re-enter Password:", 25, 150, 50,30) $adminpasscheck = GUICtrlCreateInput("", 135, 150, 75,20,$ES_PASSWORD) $passencrypt = GUICtrlCreateInput("", 105, 150, 75,20,$ES_PASSWORD) GUICtrlSetState(-1,$GUI_HIDE) $passok = GUICtrlCreateButton ("OK", 75, 190, 75,25) GUISetState() Do $msg2 = GUIGetMsg() if $msg2 = $passok then GuiCtrlSetData($passencrypt,_StringEncrypt(0,$pass[1][1],"maqleod",5)) if (GUICtrlRead($adminpass)) = (GUICtrlRead($adminpasscheck)) AND (GUICtrlRead($adminpassold)) = (GUICtrlRead($passencrypt)) then GuiCtrlSetData($passencrypt,_StringEncrypt(1,(GUICtrlRead($adminpass)),"maqleod",5)) IniWrite("data.ini", "Admin", "Password", (GUICtrlRead($passencrypt))) MsgBox(64, "Success", "Your password has been changed.") ExitLoop elseif (GUICtrlRead($adminpass)) <> (GUICtrlRead($adminpasscheck)) then MsgBox(64, "Error", "Passwords did not match, please re-enter passwords.") elseif (GUICtrlRead($adminpassold)) <> (GUICtrlRead($passencrypt)) then MsgBox(64, "Error", "You do not have sufficient access to make this change.") GUICtrlSetData($adminpass,"") GUICtrlSetState($adminpass,$GUI_FOCUS) endif endif Until $msg2 = $GUI_EVENT_CLOSE GUIDelete($child2) endif endif if $msg = $about then $child1 = GUICreate("About",220, 220,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) $font = "Ariel" Opt("RunErrorsFatal",0) GUICtrlCreateLabel($name & " " & $version,50,30,150,30) GUICtrlSetFont(-1,10,400,$font) GUICtrlCreateIcon("icons\securepad.ico",-1,85,65,48,48) GUICtrlCreateLabel("Written By MaQleod", 55,120,150,30) GUICtrlSetFont (-1,10, 400, $font) $aboutok = GUICtrlCreateButton ("OK",75,170,75,25) GUISetState() Do $msg1 = GUIGetMsg() if $msg1 = $aboutok then ExitLoop endif Until $msg1 = $GUI_EVENT_CLOSE GUIDelete($child1) endif Until $msg = $GUI_EVENT_CLOSE OnClose() IniWrite("data.ini","Font","font","Arial") IniWrite("data.ini","Font","size","10") IniWrite("data.ini","Font","style","Normal") GUIDelete() Func Open() $modifycheck = _GUICtrlEditGetModify($edit) if $modifycheck <> 0 then $yesno = MsgBox(3,"Info","Would you like to save the current document?") if $yesno = 7 then OpenFile() elseif $yesno = 6 then Save() OpenFile() elseif $yesno = 2 then endif else OpenFile() endif EndFunc Func OpenFile() $fileopen = FileOpenDialog("Open File", "", "Securepad Files(*.spt)|Text Files(*.txt)") if @error then else $filetype = StringRight($fileopen, 3) if $filetype = "spt" then $title = WinGetTitle($name,"") WinSetTitle($title,"",$name & " - " & $fileopen & "") $defile = FileRead($fileopen) $docde = "finnmacumhail" $decrypt = _StringEncrypt(0,$defile,$docde,3) GUICtrlSetData($edit,$decrypt) _GUICtrlEditEmptyUndoBuffer($edit) else $title = WinGetTitle($name,"") WinSetTitle($title,"",$name & " - " & $fileopen & "") $defile = FileRead($fileopen) GUICtrlSetData($edit,$defile) _GUICtrlEditEmptyUndoBuffer($edit) endif endif EndFunc Func New() $modifycheck = _GUICtrlEditGetModify($edit) if $modifycheck <> 0 then $yesno = MsgBox(3,"Info","Would you like to save the current document?") if $yesno = 7 then $title = WinGetTitle($name,"") WinSetTitle($title,"",$name) GUICtrlSetData($edit, "") _GUICtrlEditEmptyUndoBuffer($edit) elseif $yesno = 6 then Save() $title = WinGetTitle($name,"") WinSetTitle($title,"",$name) GUICtrlSetData($edit, "") _GUICtrlEditEmptyUndoBuffer($edit) elseif $yesno = 2 then endif else $title = WinGetTitle($name,"") WinSetTitle($title,"",$name) GUICtrlSetData($edit, "") _GUICtrlEditEmptyUndoBuffer($edit) endif EndFunc Func Save() $title = WinGetTitle($name,"") if $title = $name then SaveAs() else $filetype = StringRight($title, 3) if $filetype = "spt" then $filesavedialog = StringTrimLeft($title,12) FileDelete($filesavedialog) $docen = "finnmacumhail" $encrypt = _StringEncrypt(1,GUICtrlRead($edit),$docen,3) FileWrite($filesavedialog,$encrypt) elseif $filetype = "txt" then $filesavedialog = StringTrimLeft($title,12) FileDelete($filesavedialog) FileWrite($filesavedialog,GuiCtrlRead($edit)) _GUICtrlEditSetModify($edit,"False") endif endif EndFunc Func SaveAs() $filesavedialog = FileSaveDialog("Save File","","Securepad Files(*.spt)|Text Files(*.txt)") if @error then else $filetype = StringRight($filesavedialog, 3) if $filetype = "spt" then FileDelete($filesavedialog) $docen = "finnmacumhail" $encrypt = _StringEncrypt(1,GUICtrlRead($edit),$docen,3) FileWrite($filesavedialog,$encrypt) $title = WinGetTitle($name,"") WinSetTitle($title,"",$name & " - " & $filesavedialog & "") _GUICtrlEditSetModify($edit,"False") elseif $filetype = "txt" then FileWrite($filesavedialog,GuiCtrlRead($edit)) $title = WinGetTitle($name,"") WinSetTitle($title,"",$name & " - " & $filesavedialog & "") _GUICtrlEditSetModify($edit,"False") else $filesavedialog &= ".txt" FileWrite($filesavedialog,GuiCtrlRead($edit)) $title = WinGetTitle($name,"") WinSetTitle($title,"",$name & " - " & $filesavedialog & "") _GUICtrlEditSetModify($edit,"False") endif endif EndFunc Func Print() $readeditprint = GUICtrlRead($edit) $filewriteprint = FileWrite(@TempDir & "\printtest.txt",$readeditprint) $file = @TempDir & "\printtest.txt" _FilePrint($file) Sleep(500) FileDelete(@TempDir & "\printtest.txt") EndFunc Func Speak($text, $rate, $volme) $voice.Rate = $rate $voice.Volume = $volme $voice.Speak($text) EndFunc Func SpeakText() $texttoread = GUICtrlRead($edit) Speak($texttoread,0,100) EndFunc Func Undo() _GUICtrlEditUndo($edit) EndFunc Func Cut() ClipPut(ControlCommand($parent, "", $edit, "GetSelected", "")) _GUICtrlEditReplaceSel($edit,"True","") EndFunc Func Copy() ClipPut(ControlCommand($parent, "", $edit, "GetSelected", "")) EndFunc Func Paste() $clipboard = ClipGet() _GUICtrlEditReplaceSel($edit,"True",$clipboard) EndFunc Func SelectAll() _GUICtrlEditSetSel($edit, 0, -1) EndFunc Func Find() $lastfind = IniRead("data.ini","Find","last","") $case = IniRead("data.ini","Find","case","0") $child2= GUICreate("Find",220, 120,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent) Opt("RunErrorsFatal",0) $texttofind = GuiCtrlCreateInput($lastfind,15,25,100,20) $findcase = GuiCtrlCreateCheckbox("Case Sensitive",125,25,100,20) if $case = "1" then GuiCtrlSetState($findcase,$GUI_CHECKED) endif $findtext = GUICtrlCreateButton ("Find",60,60,75,25) GUISetState() Do $msg2 = GUIGetMsg() if $msg2 = $findtext then if GUICtrlRead($findcase) = $GUI_CHECKED then $casesense = 1 elseif GUICtrlRead($findcase) = $GUI_UNCHECKED then $casesense = 0 endif $findsel = StringInStr(GuiCtrlRead($edit),GuiCtrlRead($texttofind),$casesense,1) if $findsel <> 0 then _GUICtrlEditSetSel($edit, $findsel - 1, $findsel + StringLen(GuiCtrlRead($texttofind)) - 1) elseif $findsel = 0 then MsgBox(0, "Find", "Securepad cannot find the string in the document.") endif IniWrite("data.ini","Find","last",GuiCtrlRead($texttofind)) IniWrite("data.ini","Find","occurance",2) if $casesense = 1 then IniWrite("data.ini","Find","case","1") elseif $casesense = 0 then IniWrite("data.ini","Find","case","0") endif ExitLoop endif Until $msg2 = $GUI_EVENT_CLOSE GUIDelete($child2) EndFunc Func FindNext() $findoccurance = IniRead("data.ini","Find","occurance","1") $lastfind = IniRead("data.ini","Find","last","") $case = IniRead("data.ini","Find","case","0") $findsel = StringInStr(GuiCtrlRead($edit),$lastfind,$case,$findoccurance) if $findsel <> 0 then _GUICtrlEditSetSel($edit, $findsel - 1, $findsel + StringLen($lastfind) - 1) elseif $findsel = 0 then IniWrite("data.ini","Find","occurance",1) $findoccurance = IniRead("data.ini","Find","occurance","1") $lastfind = IniRead("data.ini","Find","last","") $case = IniRead("data.ini","Find","case","0") $findsel = StringInStr(GuiCtrlRead($edit),$lastfind,$case,$findoccurance) _GUICtrlEditSetSel($edit, $findsel - 1, $findsel + StringLen($lastfind) - 1) endif IniWrite("data.ini","Find","occurance",$findoccurance + 1) EndFunc Func OnClose() $modifycheck = _GUICtrlEditGetModify($edit) if $modifycheck <> 0 then $title = WinGetTitle($name,"") if $title = $name then $yesno = MsgBox(4,"Info","Would you like to save the current document?") if $yesno = 7 then elseif $yesno = 6 then SaveAs() endif else $file = StringTrimLeft($title,22) $defile = FileRead($file) $docde = "finnmacumhail" $decrypt = _StringEncrypt(0,$defile,$docde,3) if GUICtrlRead($edit) <> $decrypt then $yesno = MsgBox(4,"Info","Would you like to save the current document?") if $yesno = 7 then elseif $yesno = 6 then SaveAs() endif else endif endif endif IniWrite("data.ini","Find","last","") IniWrite("data.ini","Find","case","0") IniWrite("data.ini","Find","occurance","1") EndFunc Func ShowMenu($hWnd, $nContextID) Local $hMenu = GUICtrlGetHandle($nContextID) $arPos = MouseGetPos() Local $x = $arPos[0] Local $y = $arPos[1] DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0) EndFunc Source, Folder w/icon, .ini, and include: Securepad.zip Edited September 6, 2007 by maqleod [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
martin Posted September 7, 2007 Share Posted September 7, 2007 3)if I compile the script and run it from command line (fullpath.exe fullpath.txt) I get an error that says: Line -1: Error: Subscript used with non-Array variable. I can't figure out what is causing that error.Too much for me get to get involved with. But I looked at the first few lines of your code.The error you get can be determined by adding error checking to your script. For example you have an inreadsection which returns an array if successful but not if it fails. Your script assumes it is successful because you use the result as an array but how do you know it is?There could be more like that but you're asking a lot for someone to spend time going through all that when you could do it yourself. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
maqleod Posted September 7, 2007 Author Share Posted September 7, 2007 Too much for me get to get involved with. But I looked at the first few lines of your code.The error you get can be determined by adding error checking to your script. For example you have an inreadsection which returns an array if successful but not if it fails. Your script assumes it is successful because you use the result as an array but how do you know it is?There could be more like that but you're asking a lot for someone to spend time going through all that when you could do it yourself.the inireadsection is not the error, the script only errors when run from the command line. I've checked all I can, I have no idea what line -1 means, if it gave me a valid line, fine, I'd do it myself, but I don't understand the error, hence asking for help.as for the two other issues, I've spent a lot of time looking for ways to do those tasks and I've tried absolutely everything I know how to do based on what I've found on the forums and in the help file and still have found nothing, hence asking for help.That is what this forum is here for, right? [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
maqleod Posted September 9, 2007 Author Share Posted September 9, 2007 I stand corrected, it was the iniread in the beginning that was causing the crash, although I still don't know why it only crashed when opening the compiled script by command line and no other time. In any case, if anyone knows how to tell what filter was used on a filesavedialog or how to apply and remove word wrap from an edit box after the edit box was created, please let me know. [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
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