Jump to content

Search the Community

Showing results for tags 'batch'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 19 results

  1. So after many weekends of battling with this I finally figured it; then I automated it. This script includes icon sushi (which is used to remove the 256 x 256 elements from each .ico) and RDG (to compile the icons into dll). I had to idiot proof this for when I inevitably forget how to do it. First GUI will ask you to choose a name (among other things) for your .dll file. Next GUI is a drag-and-drop box. Drag-and-drop your .ico files into the box and click Go. Error checking is minimal; it works fine for me but YRMV. I'm no master programmer at all but if this script can help you as much as it helped me then cool. Download: ico2dll.Exe Known issues: .ico's containing any layers larger than 256 x 256 px will be ignored by icon sushi ico2dll only registers one drag-and-drop event so put all your required icons into one folder; then drag-and-drop them into ico2dll Extra info: Basically, the RC.exe that is included with Visual Studio doesn't seem to support 256 x 256 or larger icons when creating a resource-only .dll file. This script uses icon sushi to remove all 256 x 256 elements from your .ico files (if your icon file contains any layers larger than 256 x 256 then you will have to remove those manually through a program like gimp) before compiling them into the .dll. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\ICONS\Capital18-Ethereal-2-Mimetypes-dll.ico #AutoIt3Wrapper_Outfile=ico2dll.Exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiEdit.au3> #include <File.au3> #include <Misc.au3> #include <Array.au3> Opt("trayicondebug", 1) $tmp = "C:\ico2dlltemp\" $tmprmv = "C:\ico2dlltemp\rmv\" If FileExists($tmp) Then DirRemove($tmp, 1) Sleep(100) DirCreate($tmprmv) Global $FileName, $ListViewIndexSel = -1, $PathAllExist, $RCFile, $vpath Global $szDrive, $szDir, $szFName, $szExt, $dBox, $iData, $vdata2, $lang, $iData2 Global $TmpDir = @TempDir & "\ResDllGen" Global $TmpDirplusSlash = @TempDir & "\ResDllGen\" Global $Res_List, $Res_Name, $Res_Type, $Res_Path, $StrLenPath, $Bloc, $LangHex If FileExists($TmpDir) Then DirRemove($TmpDir, 1) If FileExists($TmpDirplusSlash) Then DirRemove($TmpDirplusSlash, 1) Sleep(100) DirCreate($TmpDirplusSlash) $rnd = Random(999, 99999, 1) DirCreate(@ScriptDir & "\tools\") DirCreate(@ScriptDir & "\Languages\") FileInstall("aicon.exe", @ScriptDir & "\aicon.exe") FileInstall("aicon.ini", @ScriptDir & "\aicon.ini") FileInstall("brushes", @ScriptDir & "\brushes") FileInstall("Languages\English.lng", @ScriptDir & "\Languages\English.lng") FileInstall("Languages\“ú–{Œê.lng", @ScriptDir & "\Languages\“ú–{Œê.lng") FileInstall("Languages\Default.lng", @ScriptDir & "\Languages\Default.lng") ;FileInstall("G:\autoo\resdll\generator\RDG.exe", @ScriptDir & "\RDG.exe") FileInstall("tools\cvtres.exe", @ScriptDir & "\tools\cvtres.exe") FileInstall("tools\DLLSZ.ico", @ScriptDir & "\tools\DLLSZ.ico") FileInstall("tools\link.exe", @ScriptDir & "\tools\link.exe") FileInstall("tools\mspdb50.dll", @ScriptDir & "\tools\mspdb50.dll") FileInstall("tools\rc.exe", @ScriptDir & "\tools\rc.exe") FileInstall("tools\RCdll.dll", @ScriptDir & "\tools\RCdll.dll") Const $SP = "#~#" Dim $Lang _SelectLanguage() $Res_Gui_2 = GUICreate($lang[22], 390, 470, -1, -1, -1) ; DLL Info $FileVersion_Title = GUICtrlCreateLabel($lang[23] & " :", 110, 8, 171, 28) ; DLL Informations GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUICtrlCreateLabel($lang[24], 15, 60, 125, 20) ; Dll Filename GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Dll_File_Name = GUICtrlCreateInput($lang[25], 175, 60, 140, 21) ; MyDll GUICtrlCreateLabel(".Dll", 318, 63, 30, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlCreateLabel($lang[26], 16, 92, 130, 20) ; File Version GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Dll_Ver1 = GUICtrlCreateInput("01", 175, 92, 35, 21, BitOR($ES_AUTOHSCROLL, $ES_NUMBER)) $UpD1 = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 99, 01) $Dll_Ver2 = GUICtrlCreateInput("00", 220, 92, 35, 21, BitOR($ES_AUTOHSCROLL, $ES_NUMBER)) $UpD2 = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 99) $Dll_Ver3 = GUICtrlCreateInput("0000", 265, 92, 49, 21, BitOR($ES_AUTOHSCROLL, $ES_NUMBER)) $UpD3 = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 9999) $Dll_Ver4 = GUICtrlCreateInput("0000", 325, 92, 49, 21, BitOR($ES_AUTOHSCROLL, $ES_NUMBER)) $UpD4 = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 9999) GUICtrlCreateLabel($lang[27], 16, 127, 150, 20) ; Product Version GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Dll_PVer1 = GUICtrlCreateLabel("01,00,0000,0000", 175, 130, 90, 20) $Dll_PVer2 = GUICtrlCreateInput("", 265, 127, 110, 21) GUICtrlCreateLabel($lang[28], 16, 165, 150, 20) ; Product Name GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Dll_Prod_Name = GUICtrlCreateInput($lang[29], 175, 165, 200, 21) ; Name_Of_Your_Product GUICtrlCreateLabel($lang[30], 16, 200, 150, 20) ; Compagny Name GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Dll_Compagny = GUICtrlCreateInput($lang[31], 175, 200, 200, 21) ; Type_Your_Company GUICtrlCreateLabel($lang[32], 16, 235, 150, 20) ; Legal Copyright GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Dll_Copyright = GUICtrlCreateInput($lang[33], 175, 235, 200, 21) ; Copyright_(C)_2007-2008 GUICtrlCreateLabel($lang[34], 16, 270, 150, 20) ; File Description GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Dll_File_Desc = GUICtrlCreateInput($lang[35], 175, 270, 200, 21) ; Type_Your_Description GUICtrlCreateLabel($lang[36], 16, 305, 150, 20) ; Language GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Dll_Lang = GUICtrlCreateCombo("", 175, 305, 90, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $lang[37], $lang[38]) ; English|French ; English ; See http://msdn.microsoft.com/en-us/library/aa381058%28VS.85%29.aspx for value. GUICtrlCreateLabel($lang[39], 16, 340, 150, 20) ; File OS GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Dll_OS = GUICtrlCreateCombo("", 175, 340, 90, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $lang[40], $lang[41]) ; 0x40004 ; 0x40004 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateLabel($lang[42], 16, 375, 150, 20) ; File Type GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Dll_File_Type = GUICtrlCreateCombo("", 175, 375, 90, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $lang[43], $lang[44]) ; 0x2 ; 0x2 GUICtrlSetState(-1, $GUI_DISABLE) $Btn_OK2 = GUICtrlCreateButton($lang[45], 160, 432, 75, 25) ; OK GUISetState(@SW_SHOW, $Res_Gui_2) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Btn_OK2 If GUICtrlRead($Dll_File_Name) = $lang[25] Then ; MyDll MsgBox(32 + 8192, $lang[53], $lang[54] & @TAB) ; Dll File Name ; Please, Enter The Name Of Your Dll GUICtrlSetState($Dll_File_Name, $GUI_FOCUS) Else GUICtrlSetData($Dll_File_Name, StringReplace(GUICtrlRead($Dll_File_Name), " ", "_")) SetDllData() GUIDelete($Res_Gui_2) AddIcons() EndIf Case $UpD1, $UpD2, $UpD3, $UpD4 _UpdateVerNum() Case $GUI_EVENT_PRIMARYDOWN _UpdateVerNum() Case $GUI_EVENT_CLOSE TraySetState(2) Exit EndSwitch WEnd Func AddIcons() Global $__aGUIDropFiles = 0, $aDrop_List = 0 Global $txtInput = "Drag and drop your .ico files here" $mGUI = GUICreate("ico2dll", 900, 400, -1, -1, "", $WS_EX_ACCEPTFILES) $dBox = GUICtrlCreateEdit($txtInput, 10, 10, 874, 300) GUICtrlSetState($dBox, $GUI_DROPACCEPTED) $gBut = GUICtrlCreateButton("Go", 10, 320, 75, 25) $eBut = GUICtrlCreateButton("Exit", 810, 320, 75, 25) GUISetState() GUIRegisterMsg($WM_DROPFILES, 'On_WM_DROPFILES') While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE TraySetState(2) DirRemove($tmp, 1) Exit Case $eBut TraySetState(2) DirRemove($tmp, 1) Exit Case $GUI_EVENT_DROPPED GUICtrlSetData($dBox, "") For $i = 1 To $aDrop_List[0] $old = GUICtrlRead($dBox) $new = $old & $aDrop_List[$i] & @CRLF GUICtrlSetData($dBox, $new) Next Case $gBut $check = GUICtrlRead($dBox) If $check = $txtInput Then MsgBox(0, "Error", "You must drag-and-drop some .ico files into the box") ContinueLoop Else $iData = StringSplit($check, @LF) EndIf GUIDelete($mGUI) _MouseTrap(0, 0, 1, 1) CopyTemp() Rmv256() GenDll() _MouseTrap() EndSwitch WEnd EndFunc ;==>AddIcons Func Rmv256() DirCreate($tmprmv) IniWrite(@ScriptDir & "\aicon.ini", "Option", "ListViewMode", "0") IniWrite(@ScriptDir & "\aicon.ini", "Option", "InitialDir", "C:\ico2dlltemp") Global $PID2 = "" $last = "placeholder" $Amow = 100 $hWnd2 = "" $aPID = Run(@ScriptDir & "\aicon.exe") WinWaitActive("@icon sushi", "", 10) $theWinlist = WinList() Do For $i = 1 To $theWinlist[0][0] If $theWinlist[$i][0] <> "" Then $iPID2 = WinGetProcess($theWinlist[$i][1]) If $iPID2 = $aPID Then $hWnd2 = $theWinlist[$i][1] ExitLoop EndIf EndIf Next Until $hWnd2 <> 0 Sleep(1000) Send("{ALT}FO") WinWaitActive("Open Source File(s)", "", 10) Sleep(200) ControlClick("Open Source File(s)", "", 1) Sleep(200) Send("^a{ENTER}") Sleep(200) Do Sleep(200) If WinExists("@icon sushi", "is not a supported file") Then Sleep(200) Send("{ENTER}") EndIf $treeCtrl = ControlGetHandle($hWnd2, "", "[CLASS:TListView; INSTANCE:1]") ControlClick($hWnd2, "", $treeCtrl, "", "", 34, 29) $textCtrl = ControlGetHandle($hWnd2, "", "[CLASS:TPanel; INSTANCE:3]") Until ControlGetText($hWnd2, "", $textCtrl) <> "" Sleep(200) While 1 $textSrch = ControlGetText($hWnd2, "", $textCtrl) If $textSrch = $last Then ExitLoop If StringInStr($textSrch, "256 x 256") Then Send("{ALT}L") Sleep(30) Send("D") Sleep(30) Send("D{ENTER}") Else Send("{DOWN}") EndIf $last = $textSrch WEnd Sleep(200) Send("{ALT}LA") Sleep(200) Send("{ALT}TG") WinWaitActive("Browse for Folder", "", 10) $hnd = WinGetHandle("Browse for Folder") ControlClick($hnd, "", 14145) Sleep(100) Send("ico2dlltemp") Sleep(100) Send("{RIGHT}") Sleep(100) Send("{RIGHT}") Sleep(100) Send("{ENTER}") WinClose($hWnd2) WinWaitClose($hWnd2) EndFunc ;==>Rmv256 Func GenDll() If _GenerateRC() Then $SName = $Dll_File_Name FileInstall("./Tools/cvtres.exe", $TmpDir & "\", 1) FileInstall("./Tools/link.exe", $TmpDir & "\", 1) FileInstall("./Tools/mspdb50.dll", $TmpDir & "\", 1) FileInstall("./Tools/RC.exe", $TmpDir & "\", 1) FileInstall("./Tools/RCdll.dll", $TmpDir & "\", 1) $i = 1 $IdxCount = $vdata2[0] - 2 For $i = 0 To $IdxCount $RC_Res_FilePath = $vdata2[$i + 1] FileCopy($RC_Res_FilePath, $TmpDir & "\", 9) Next RunWait(@ComSpec & ' /c ' & 'rc /r ' & $SName & '.rc', $TmpDir, @SW_HIDE) RunWait(@ComSpec & ' /c ' & 'link /nodefaultlib /dll /machine:ix86 /noentry /out:' & _ $SName & '.dll ' & $SName & '.res', $TmpDir, @SW_HIDE) If FileExists($TmpDir & "\" & $SName & ".dll") Then FileCopy($TmpDir & "\" & $SName & ".dll", "C:\" & $SName & "-" & $rnd & ".dll", 1) MsgBox(0, "Success", "File created successfuly at:" & @CRLF & "C:\" & $SName & "-" & $rnd & ".dll") DirRemove($tmp) DirRemove($TmpDir) Exit Else MsgBox(16 + 8192, $lang[51], $lang[52] & @TAB) ; Error ; Error Creating Dll File Exit EndIf ;ShellExecute($TmpDir) EndIf EndFunc ;==>GenDll Func CopyTemp() $i = 1 For $i = 1 To $iData[0] - 1 $iData2 = StringReplace($iData[$i], @CR, "") FileCopy($iData2, $tmp & $i & ".ico", 9) If @error Then MsgBox(0, "Failed", "Unknown error. Sorry.") Exit EndIf Next EndFunc ;==>CopyTemp Func _CleanInput() _GUICtrlListView_SetItemSelected($Res_List, $ListViewIndexSel, False) $ListViewIndexSel = "" GUICtrlSetData($Res_Name, "") GUICtrlSetData($Res_Type, "ICON") GUICtrlSetData($Res_Path, "") EndFunc ;==>_CleanInput Func _PathLen($PathIn) If StringLen($PathIn) > $StrLenPath Then $StrLenPath = StringLen($PathIn) + 10 GUICtrlSendMsg($Res_List, $LVM_SETCOLUMNWIDTH, 2, $StrLenPath * 5) EndIf EndFunc ;==>_PathLen Func _UpdateVerNum() GUICtrlSetData($Dll_Ver1, StringFormat("%002s", GUICtrlRead($Dll_Ver1))) GUICtrlSetData($Dll_Ver2, StringFormat("%002s", GUICtrlRead($Dll_Ver2))) GUICtrlSetData($Dll_Ver3, StringFormat("%004s", GUICtrlRead($Dll_Ver3))) GUICtrlSetData($Dll_Ver4, StringFormat("%004s", GUICtrlRead($Dll_Ver4))) GUICtrlSetData($Dll_PVer1, StringFormat("%002s", GUICtrlRead($Dll_Ver1)) & "," & _ StringFormat("%002s", GUICtrlRead($Dll_Ver2)) & "," & _ StringFormat("%004s", GUICtrlRead($Dll_Ver3)) & "," & _ StringFormat("%004s", GUICtrlRead($Dll_Ver4))) EndFunc ;==>_UpdateVerNum Func _GenerateRC() $vdata2 = _FileListToArray($tmprmv) $i = 1 For $i = 1 To $vdata2[0] FileCopy($tmprmv & $vdata2[$i], $TmpDir & "\" & $i & ".ico", 9) Next $vdata2 = _FileListToArray($tmprmv) $IdxCount = $vdata2[0] $i = 1 If $IdxCount > 0 Then $RCFile = $TmpDir & "\" & $Dll_File_Name & ".rc" $hRCOut = FileOpen($RCFile, 1) If $hRCOut = -1 Then Return 0 $RC_Res_Type = "ICON" For $i = 1 To $IdxCount FileCopy($tmprmv & $vdata2[$i], $TmpDir & "\" & $i & ".ico", 9) $RC_Res_Name = $i $RC_Res_FilePath = $TmpDir & "\" & $i & ".ico" _PathSplit($RC_Res_FilePath, $szDrive, $szDir, $szFName, $szExt) $RC_Res_File = $szFName & $szExt FileWriteLine($RCFile, $RC_Res_Name & @TAB & $RC_Res_Type & @TAB & '"' & $RC_Res_File & '"') Next FileWriteLine($RCFile, @CRLF & '1 VERSIONINFO' & @CRLF & _ 'FILEVERSION ' & $Dll_PVer1 & @CRLF & _ 'PRODUCTVERSION ' & $Dll_PVer1 & @CRLF & _ 'FILEOS ' & $Dll_OS & @CRLF & _ 'FILETYPE ' & $Dll_File_Type & @CRLF & _ '{' & @CRLF & 'BLOCK "StringFileInfo"' & @CRLF & '{' & @CRLF & _ @TAB & 'BLOCK "' & $Bloc & '"' & @CRLF & @TAB & '{' & @CRLF & _ @TAB & @TAB & 'VALUE "CompanyName", "' & $Dll_Compagny & '"' & @CRLF & _ @TAB & @TAB & 'VALUE "FileDescription", "' & $Dll_File_Desc & '"' & @CRLF & _ @TAB & @TAB & 'VALUE "FileVersion", "' & $Dll_PVer1 & '"' & @CRLF & _ @TAB & @TAB & 'VALUE "InternalName", "' & $Dll_File_Name & '.dll"' & @CRLF & _ @TAB & @TAB & 'VALUE "LegalCopyright", "' & $Dll_Copyright & '"' & @CRLF & _ @TAB & @TAB & 'VALUE "OriginalFilename", "' & $Dll_File_Name & '.dll"' & @CRLF & _ @TAB & @TAB & 'VALUE "ProductName", "' & $Dll_Prod_Name & '"' & @CRLF & _ @TAB & @TAB & 'VALUE "ProductVersion", "' & $Dll_PVer1 & " " & $Dll_PVer2 & '"' & @CRLF & _ @TAB & @TAB & 'VALUE "Comments", ""' & @CRLF & _ @TAB & '}' & @CRLF & '}' & @CRLF & @CRLF & 'BLOCK "VarFileInfo"' & @CRLF & '{' & @CRLF & _ @TAB & 'VALUE "Translation", ' & $LangHex & @CRLF & '}' & @CRLF & '}') FileClose($hRCOut) Return 1 Else Return 0 EndIf EndFunc ;==>_GenerateRC Func On_WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam) ; Credit to ProgAndy for DLL calls #forceref $hWnd, $iMsg, $lParam Local $iSize, $pFileName ; Get number of files dropped Local $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 0) ; Reset array to correct size Global $aDrop_List[$aRet[0] + 1] = [$aRet[0]] ; And add item names For $i = 0 To $aRet[0] - 1 $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $iSize = $aRet[0] + 1 $pFileName = DllStructCreate("wchar[" & $iSize & "]") DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $iSize) $aDrop_List[$i + 1] = DllStructGetData($pFileName, 1) $pFileName = 0 Next ; Send the count to trigger the drop function in the main loop GUICtrlSendToDummy($dBox, $aDrop_List[0]) EndFunc ;==>On_WM_DROPFILES Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ;#forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $Res_List If Not IsHWnd($Res_List) Then $hWndListView = GUICtrlGetHandle($Res_List) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $ListViewIndexSel = DllStructGetData($tInfo, "Index") GUICtrlSetData($Res_Name, _GUICtrlListView_GetItemText($hWndListView, $ListViewIndexSel, 0)) GUICtrlSetData($Res_Type, _GUICtrlListView_GetItemText($hWndListView, $ListViewIndexSel, 1)) GUICtrlSetData($Res_Path, _GUICtrlListView_GetItemText($hWndListView, $ListViewIndexSel, 2)) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func SetDllData() Switch GUICtrlRead($Dll_Lang) Case 'French' Or 'Francais' $Bloc = '040C04B0' $LangHex = '0x040C 0x04B0' Case Else ; 'English' Or 'Anglais' $Bloc = '040904B0' $LangHex = '0x0409 0x04B0' EndSwitch $Dll_File_Name = StringReplace(GUICtrlRead($Dll_File_Name), " ", "_") $Dll_PVer1 = GUICtrlRead($Dll_PVer1) $Dll_PVer2 = GUICtrlRead($Dll_PVer2) $Dll_OS = GUICtrlRead($Dll_OS) $Dll_File_Type = GUICtrlRead($Dll_File_Type) $Dll_Compagny = GUICtrlRead($Dll_Compagny) $Dll_File_Desc = GUICtrlRead($Dll_File_Desc) $Dll_Copyright = GUICtrlRead($Dll_Copyright) $Dll_Prod_Name = GUICtrlRead($Dll_Prod_Name) EndFunc ;==>SetDllData ; Function to select language. Func _SelectLanguage() If StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang) Then RDG_FR() ; French Language Else RDG_EN() ; English Language EndIf $Lang = StringSplit($Lang, $SP, 1) EndFunc ; English Language. Func RDG_EN() $Lang = "Resource DLL Generator" & $SP $Lang &= "Resource Name" & $SP $Lang &= "Type Name Without Space (Max len 10)" & $SP $Lang &= "Resource Type" & $SP $Lang &= "Choose Resource Type" & $SP $Lang &= "Resource Path" & $SP $Lang &= "Select File First" & $SP $Lang &= "Path Of The Resource File" & $SP $Lang &= "Select Path Of The Resource File First" & $SP $Lang &= "Delete Resource" & $SP $Lang &= "Delete Selected Resource" & $SP $Lang &= "Add Resource" & $SP $Lang &= "Add or Update Resource" & $SP $Lang &= " Name | Type | Path " & $SP $Lang &= "Clic Twice To Edit An Item" & $SP $Lang &= "Exit" & $SP $Lang &= "Exit Program" & $SP $Lang &= "Dll Informations" & $SP $Lang &= "Chose Dll Informations" & $SP $Lang &= "Generate Dll" & $SP $Lang &= "Generate The Dll" & $SP $Lang &= "DLL Info" & $SP $Lang &= "DLL Informations" & $SP $Lang &= "Dll Filename" & $SP $Lang &= "MyDll" & $SP $Lang &= "File Version" & $SP $Lang &= "Product Version" & $SP $Lang &= "Product Name" & $SP $Lang &= "Name_Of_Your_Product" & $SP $Lang &= "Compagny Name" & $SP $Lang &= "Type_Your_Compagny" & $SP $Lang &= "Legal Copyright" & $SP $Lang &= "Copyright_(C)_2007-2008" & $SP $Lang &= "File Description" & $SP $Lang &= "Type_Your_Description" & $SP $Lang &= "Language" & $SP $Lang &= "English|French" & $SP $Lang &= "English" & $SP $Lang &= "File OS" & $SP $Lang &= "0x40004" & $SP $Lang &= "0x40004" & $SP $Lang &= "File Type" & $SP $Lang &= "0x2" & $SP $Lang &= "0x2" & $SP $Lang &= "OK" & $SP $Lang &= "Select file to add In DLL" & $SP $Lang &= "All" & $SP $Lang &= "Select The Destination Of Dll File" & $SP $Lang &= "Succes" & $SP $Lang &= "Dll successfully saved on" & $SP $Lang &= "Error" & $SP $Lang &= "Error Creating Dll File" & $SP $Lang &= "Dll File Name" & $SP $Lang &= "Please, Enter The Name Of Your Dll" EndFunc ; French Language. Func RDG_FR() $Lang = "Ressource DLL Generator" & $SP $Lang &= "Nom de la ressource" & $SP $Lang &= "Tapez le nom sans espace (Max 10 caractères)" & $SP $Lang &= "Type de la ressource" & $SP $Lang &= "Choisissez un type de ressource" & $SP $Lang &= "Chemin de la ressource" & $SP $Lang &= "Choisir d'abord le fichier de ressource" & $SP $Lang &= "Chemin du fichier de ressource" & $SP $Lang &= "Sélectionnez le fichier de ressource" & $SP $Lang &= "Supprime ressource" & $SP $Lang &= "Supprime la ressource sélectionnée." & $SP $Lang &= "Ajoute ressource" & $SP $Lang &= "Ajoute ou met à jour la ressource." & $SP $Lang &= " Nom | Type | Chemin " & $SP $Lang &= "Cliquez deux fois pour éditer une ressource." & $SP $Lang &= "Sortie" & $SP $Lang &= "Sortie du programme." & $SP $Lang &= "Informations Dll" & $SP $Lang &= "Règlez les information de la Dll." & $SP $Lang &= "Générer la Dll" & $SP $Lang &= "Générez la Dll" & $SP $Lang &= "Info DLL" & $SP $Lang &= "Informations DLL" & $SP $Lang &= "Nom de la Dll" & $SP $Lang &= "MaDll" & $SP $Lang &= "Version du fichier" & $SP $Lang &= "Version du produit" & $SP $Lang &= "Nom du produit" & $SP $Lang &= "Nom_de_votre_produit" & $SP $Lang &= "Nom de la société" & $SP $Lang &= "Nom_de_votre_société" & $SP $Lang &= "Copyright légale" & $SP $Lang &= "Copyright_(C)_2007-2008" & $SP $Lang &= "Description du fichier" & $SP $Lang &= "Entrez_votre_description" & $SP $Lang &= "Langue" & $SP $Lang &= "Anglais|Français" & $SP $Lang &= "Français" & $SP $Lang &= "Système de fichiers" & $SP $Lang &= "0x40004" & $SP $Lang &= "0x40004" & $SP $Lang &= "Type de fichiers" & $SP $Lang &= "0x2" & $SP $Lang &= "0x2" & $SP $Lang &= "OK" & $SP $Lang &= "Sélectionnez le fichier à ajouter à la DLL" & $SP $Lang &= "Tout Fichier" & $SP $Lang &= "Sélectionnez la destination de la Dll" & $SP $Lang &= "Succés" & $SP $Lang &= "Dll sauvegardée avec succés sur" & $SP $Lang &= "Erreur" & $SP $Lang &= "Erreur lors de la création de la Dll" & $SP $Lang &= "Nom du fichier Dll" & $SP $Lang &= "Veuillez entrer le nom de la Dll" EndFunc ico2dll.Exe
  2. I need to change user's passwords remotely for Linux devices. I was recommended using plink for achieving the same, but I am facing little issue while resetting the passwords. Sharing the command using which I change password via cmd (working): echo 'y' | plink.exe admin@X.X.X.X -pw Old-password -no-antispoof "echo -e 'Old-password\nNew-password\nNew-password'|(passwd)" > passwdChange.log When I integrated it with AutoIT, I embedded the above command in a batch file as below. @echo off echo 'y' | plink.exe %1@%2 -pw %3 -no-antispoof "echo -e '%3\n%4\n%4'|(passwd)" > passwdChange.log When I try to execute the above batch file via AutoIT Run/ShellExecute command it doesn't work properly (doesn't change password). $DOS = Run(@ComSpec & " /c "&@ScriptDir &"\chpasswd.bat "&$sUser&" "&$sIP&" "&$sOldPwd&" "&$pwd, "", @SW_SHOWMAXIMIZED, $STDERR_CHILD + $STDOUT_CHILD) Where I am going & what changes I need to make in order for this to work Thank you in advance.
  3. Members 0 2 10 posts Posted 1 minute ago I have a littel script: AutoItSetOption("MustDeclareVars", 1) #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Local $iReturn  ; Returnwert Local $iVar     ; Variable Local $iBit     ; Bitnummer $iVar=$Cmdline[2] $iBit=$Cmdline[3] Switch $Cmdline[1]     Case 1         $iReturn=BitOr ($ivar,2^$iBit)     Case 2         $iReturn=BitAnd ($iVar,2^$iBit)         if ($iReturn = 2^$iBit ) Then             $iReturn=0         Else             $iReturn=1         EndIf EndSwitch Exit $iReturn which does bit handling. It works as desired but: If I want to check the Returncode of the EXE created in the calling batch within an if-clause %ERRORLEVEL% does not match the Returncode of my script (calling outside of an if-clause works as desired). My assumption for this behaviour is: I do not use enabledelayedexpansion in my batch-system and thus this special "variable" %ERRORLEVEL% is not defined in the if-clause. If my assumption is correct: How can I retransfer the Returncode to batch? Thanks - Michael
  4. Hey guys, I am very new to using AutoIt and wrote my first little script today after reading bits and pieces on the docs. The script is designed to make an ugly batch operation a bit more user friendly for the people in the office. I have a batch file that consists of: @echo off net use B: /delete net use B: \\10.10.10.10\Share /user:domain\username It is used to log a user onto a secure share drive on my NAS. I have spoofed the share location etc. however. My AutoIt Script is: Local $passwd = InputBox("Attempting to Access B:", "Enter your password.", "", "*","M") Run("C:\Users\User\Desktop\login.bat") WinWaitActive("C:\Windows\system32\cmd.exe") Send($passwd) Now this works fine, however once I input my password into the GUI and it Sends that Password to the cmd window, I cannot make it send an "ENTER" Keystroke. It isn't a HUGE issue as I can manually press enter once the cmd window shows up, but I would like it to input the password and do the carriage return straight away. I have tried using Send("{ENTER}") , and it returns an error. I have tried changing the way I implement the sending of {ENTER} in as many ways as I can think of. I would greatly appreciate it if anyone can help me on this. Also, if anyone knows of a way to run the cmd window silently but still be able to send the password to it that would be even better! Cheers
  5. TeraCopy Timer - A program of mine, front end really, that I have been working on (on & off) for some time, but not shared here before, that I recall. Third party program TeraCopy is required. Many of you will be familiar with TeraCopy, and it has been discussed here at AF on several occasions, in various sub forums, including Chat. BE ADVISED - I still use an older version of TeraCopy (v2.27), a goody but an oldy, so have only tested my program with that. It may work with the newer v3.xx, or may be easily adjusted to do so, but I have not yet gone that route. Likewise, I only use it with Win 7 and Win XP, but I don't imagine there should be any issues with newer Windows. Add to that, my program being devised and created in AutoIt v3.3.0.0. So what is TeraCopy Timer and why might you need it? -------------------------------------------------------------------------------------- Those familiar with TeraCopy use, know you can run multiple copy or move jobs either simultaneously or concurrently (one immediately after another has finished). With the free version at least, you have no control over precise order or timing, and no way to deal (without manual interaction) with the pesky Thumbs.db files in Win XP. TeraCopy Timer allows you to do all those things, and in a batch fashion. -------------------------------------------------------------------------------------- Some screenshots and brief explanation Main Window Minimalist Window This new WAIT feature is the simplest and best way to use the program generally (in my view) ... but check out the following, as it is not always the case. Advanced Delay Window WARNING - It should go without saying, that you take all the usual precautions. For instance, don't use move with the only copy you have of precious files. BACKUP BACKUP BACKUP! Don't hold me liable for anything, except for being a nice guy who likes to share. TeraCopy Timer v3.5.zip (MAJOR UPDATE - see detail at Post #39) Enjoy! OLDER DOWNLOADS P.S. I am not affiliated in any way with those who created and provide the excellent third party program - TeraCopy.
  6. Greetings, I need write a command line to run an .exe with parameters, one this parameters is a password with special characters like: [ ] \ " etc. The password is write between double cotes too. When run this command line, catch error. I buid this function, sometimes run ok, others show error. Someone can any idea? Best ragards #include <Array.au3> Global $G_AIX_DEFAULT_PASSWORD = "******" Func Scape_Word_To_MSDOS($var = "") ;~ https://www.robvanderwoude.com/escapechars.php Local $aCharacters[][2] = [ _ ["%", "%%"], _ ["^", "^^"], _ ["&", "^&"], _ ["<", "^<"], _ [">", "^>"], _ ["|", "^|"], _ ["'", "^'"], _ ["`", "^`"], _ [",", "^,"], _ [";", "^;"], _ ["=", "^="], _ ["(", "^("], _ [")", "^)"], _ ["!", "^^!"], _ ["\", "\\"], _ ["[", "\["], _ ["]", "\]"], _ ['"', '\"""'], _ [".", "\."], _ ["*", "\*"], _ ["?", "\?"] _ ] Local $iSearch $var = StringSplit($var, "", $STR_NOCOUNT) Local $iSize = UBound($var, $UBOUND_ROWS) - 1 For $ii = 0 To $iSize $iSearch = _ArraySearch($aCharacters, $var[$ii]) If $iSearch >= 0 Then $var[$ii] = $aCharacters[$iSearch][1] Next Return _ArrayToString($var, "") EndFunc ;==>Scape_Word_To_MSDOS Local $password = "-Dk5iFB2UjOt[-x|""" & "" Local $password_scape = Scape_Word_To_MSDOS($password) ConsoleWrite("[" & $password & "]" & @LF) ConsoleWrite("[" & $password_scape & "]" & @LF)
  7. i have a script that selects a text file and deletes a line (text input required) in the text file selected i have to make it remove all lines found on a file i name, toRemoveLines.txt it has to remove lines from all text files found in a folder this is the script that has to be modified where it says "select file" it has to be "select folder" where it says "line text input" it has to be all lines from a text file #Include <File.au3> Global $success = False $file_name = FileOpenDialog("Select file", @ScriptDir, "All files (*.*)", 1+4) $line_text_input = InputBox("Line's text", "Line must contain following text:", "line contains this text") $file_count_lines = _FileCountLines($file_name) for $i = 0 to $file_count_lines $Lines_text_output = FileReadLine($file_name, $i) if StringInStr($Lines_text_output, $line_text_input) then _FileWriteToLine($file_name, $i, "", 1) $success = True ExitLoop EndIf Next if $success = True Then MsgBox(0, "Success", "Line has been deleted") Else MsgBox(0, "Failure", "Line wasn't found") EndIf
  8. I'm quite new to AutoIT and I have a very big batch file that I'm trying to completely re-write in Autoit, so far it's been going well but I got stuck with a certain part, hope someone can help. Here's the part of the batch script I'm currently stuck re-creating in AutoIT:     :BeginLangMenu     if "%OptNum%" gtr "0" goto ShowLangMenu          ::Next Section code based on code supplied by Aacini from stackoverflow.com     :DefineLangMenu     for /L %%D in (1,1,99) do (        if exist Common\Settings\Data%%D.ini for /F "eol=# tokens=1,2 delims==" %%a in (Common\Settings\Data%%D.ini) do (                set line=%%a           if "!line:~2,5!" neq "clude" (              REM Define "normal" variables, i.e. Compressor, Method, etc.              set %%a=           ) else if "!line:~7!" neq "" (                   REM Define the base array elements, i.e. D1IncludeAR=%%b, D1ExcludeAR=%%b, ...              set D%%D%%a=%%b                   REM Set Show?? array elements with value equal 1, i.e. ShowAR=1, ...              REM when anyone of DiInclude?? or DiExclude?? corresponding elements was given              if defined D%%D%%a set Show!line:~7!=1                )        )     )          REM Define a list of language abbreviations, i.e. "langs=AR CZ DE ..."     REM and the corresponding language names array, i.e. lang[AR]=Arabic, ...     REM At same time, calculate original OptNum          for %%a in ("AR=Arabic" "CZ=Czech" "DE=German" "EN=English" "ES=Spanish" "ESMX=Spanish(Mexico)"                 "FR=French" "HU=Hungarian" "IT=Italian" "JP=Japanese" "KR=Korean" "PL=Polish"                 "PR=Portuguese" "PRBR=Portuguese(Brazil)" "RU=Russian" "ZH=Chinese") do (        for /F "tokens=1,2 delims==" %%b in (%%a) do (           set "langs=!langs! %%b"           set "lang[%%b]=%%c"           set /A "OptNum+=Show%%b"             )     )          ::NEXT 2 SECTIONS DISPLAYS THE LANGUAGE SELECTION MENU IF APPLICABLE     :ShowLangMenu     set /a step=%step%+1     :LangMenu     if "%OptNum%"=="0" Goto checksplit     echo %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2% - Showing Language Selection Menu >> "%workdir%Conversion.log"     REM Show the language menu     set #=0     for %%a in (%langs%) do (        if defined Show%%a (           set /A #+=1     rem       echo [!#!] !lang[%%a]!           echo !lang[%%a]! >> %b2eincfilepath%\Lang.txt           set "option[!#!]=%%a"         )     )               %MYFILES1%\DROPDOWNBOX.exe /F:"%b2eincfilepath%\Lang.txt" "Choose Which Language to Compress" "STEP %step%: Language Selection"  /W:280 /RI /C:13 >nul > %b2eincfilepath%\LangAnswer.txt     if %ERRORLEVEL% EQU 0 del %b2eincfilepath%\LangAnswer.txt     if exist %b2eincfilepath%\LangAnswer.txt set /p "SelectLang="<%b2eincfilepath%\LangAnswer.txt     if not defined SelectLang goto LangError     if %SelectLang%==Arabic Set LangOpt=AR     if %SelectLang%==Czech set LangOpt=CZ     if %SelectLang%==German set LangOpt=DE     if %SelectLang%==English set LangOpt=EN     if %SelectLang%==Spanish set LangOpt=ES     if %SelectLang%==Spanish(Mexico) set LangOpt=ESMX     if %SelectLang%==French set LangOpt=FR     if %SelectLang%==Hungarian set LangOpt=HU     if %SelectLang%==Italian set LangOpt=IT     if %SelectLang%==Japanese set LangOpt=JP     if %SelectLang%==Korean set LangOpt=KR     if %SelectLang%==Polish set LangOpt=PL     if %SelectLang%==Portuguese set LangOpt=PR     if %SelectLang%==Portuguese(Brazil) set LangOpt=PRBR     if %SelectLang%==Russian set LangOpt=RU     if %SelectLang%==Chinese set LangOpt=ZH     if defined SelectLang Goto LangSet          ::SETS THE LANGUAGE SELECTION ACCORDING TO USER INPUT IN LANGUAGE MENU     :LangSet     set "LangIs=%LangOpt%" Basically, here's what I need to do: Read from specific section of INI file but ONLY the Keys that have a Value. OR: A way to remove the keys without the values from the Array created by IniReadSection. A way to then take these stored values, and create a list of Languages based last 2-4 characters of the Key names. At this point, that said list is shown to user in DropDown box, after user make selection I need a way to move the Value of the Key related to the selected Language to a Variable, and ONLY the value for that specific Language. That's it basically, the rest is more or less Variable manipulation which isn't a problem. A little Example: My INI file have a Section like this: [LangInclude] IncludeAR=a IncludeCZ= IncludeDE=b IncludeEN= IncludeES=c IncludeESMX= IncludeFR= IncludeHU=d IncludeIT= IncludeJP= IncludeKR=e IncludePL= IncludePR= IncludePRBR= IncludeRU= IncludeZH= I need to get Only the keys that are set, in this case: IncludeAR, IncludeDE, IncludeES, IncludeHU & IncludeKR. I then need to convert these to a list of languages, in this example it will be (Arabic, German, Spanish, Hungarian, Korean). That list will be turned to DropDown selection, that I can do easily once I get the list correctly. After the user Selected, let us say for the example purpose Spanish, I need the Value of IncludeES to be moved into a Variable, like this: $Var=c I hope somebody can help me because I'm stuck after Importing the INI section with IniReadSection, everything I tried so far failed, the best I managed to do is Sort the array to have all the keys with values either at the first rows or last rows. I need some ideas. Help appreciated. Thanks
  9. Hi, I need to convert this batch, I follow microsoft specs here https://technet.microsoft.com/en-us/library/bb491005.aspx Ex: start /b 1.exe "path\2.exe" start /b mypgrcommand start /b /wait 3.exe "path\4_.exe" taskkill /F /IM 5.exe Somethings like this... RunWait( @COMSPEC & " /c start /b 1.exe 'path\2.exe' start /b mypgrcommand start /b /wait 3.exe 'path\4_.exe' taskkill /F /IM 5.exe", "", @SW_SHOW ) Thx
  10. Hi, Ich hab ein Script für Windows Updates, dass nach dem OOBE aufgerufen werden soll. Run/RunOnce ist daher nicht möglich. Stattdessen möchte ich das Script in den Autostart schreiben lasse. Wenn die OOBE beendet wird und der Administrator angemeldet wird, soll das Update-Script einmalig aufgerufen werden und sich anschl. selbst löschen. Lang rede, kurzer Sinn: Wie kann ich folgendes Script in den Autostart schreiben? RunWait(@ComSpec & " /c " & "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\UA\Scripts\win-updates.ps1 -MaxUpdatesPerCycle 100 -RestartRequired 1", "") Ich würde ungern eine BAT oder EXE reinkopieren, da ich es unsauber finde. Die müsste ja auch zusätzlich irgendwo liegen. Danke Eggsplorer
  11. I am running the tomcat batch file through autoit and need to wait until the below line I get in console output. But when I am trying to read the console output using the ProcessEx UDF, I am getting only the partial output. So, can you please suggest how to handle this.
  12. Hello guys, im just started in programming and all.. and i wanted to learn autoscript to. Was wondering if any can convert my one-liner batch script to an autoit script - FOR /F %%i IN (names.txt) DO @copy system.act %%i.act So what this does is open and read the file "names.txt" incrementally, and copy a certain file named "system.act" and rename it to each name that is listed on "names.txt" So im trying this on autoit but no idea how to start file manipulation and do command - #include <File.au3> $file = "c:\names.txt" FileOpen($file, 0) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) Can anyone help me or guide me on how to continue this to get the result that i want..:)? Thanks
  13. Hi everyone. I'm currently working a program that constantly prints out log files through "consolewrite" and the "#AutoIt3Wrapper_Change2CUI=y" wrapper. Part of this program requires me to run a batch script. My issue is the batch script launches from the same window as consolewrite. I need the batch file to be launched through a different window as currently this causes an issue with the logs (which need to be very precise) but also causes the batch file to produce some funny behavior... Does anyone know how I can force the file to run on a second DOS window? Thanks in advance!!! Edit: Im using the "run" command if that helps. I tried "shellexecute" but that seemed to not launch the batch scripts at all.
  14. I have several batch files, e.g. echo off echo !DT | ncat 192.168.1.6 80 > scan1.dta This data1.bat works as expected by saving data from !DT command. I have tried several variations from AutoIt ;  $DOS = RunWait(@ComSpec & " /k " & "ncat 192.168.1.6 80 <getdata >scan1.dta", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;  $DOS = Run(@ComSpec & " /k " & "ncat 192.168.1.6 80 <getdata >scan1.dta", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;  $DOS = Run(@ComSpec & " /c " & "echo ?DT | ncat 192.168.1.6 80 > scan1.dta & @CRLF", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)   $DOS = Run(@ComSpec & " /c " & "data1.bat & @CRLF", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) but none save the data to scan1.dta Run out of ideas so far...
  15. If I am using a RunWait command to launch a batch file from within an AutoIt script, how can I pass a variable to said batch file so that the batch file can utilize said variable like in a %var% format? Thank you in advance.
  16. I normally launch things silently, but now I want to launch a batch (.cmd) file and have it run as normal displaying it's standard output to the user. Whether I use ShellExecuteWait or RunWait, the command prompt window is displayed, but the output is blank (although I know that the batch file is processing normally because it also produces a log file). If this is because AutoIt is re-directing the standard I/O of the batch file/console window, is there a way I can bypass the I/O redirection? Thanks, TXTechie
  17. hi can you tell me how can i run cscript.exe with these arguments using a autoit script currently i'm using a batch file to run this "C:\Windows\System32\cscript.exe" "C:\project\rohit.vbs" "C:\project\fileneame.exe"
  18. Guest

    The Editor

    Here is my latest project, It is a simple code editor that supports all text formats. It will execute batch directly and will also execute maths. It also has the simple feature of shellexecute (POINTLESS!) 1 error I found was that I dont know how to tell if the script* has been saved so it has to ask the user I need to know that for executing batch where the file (if saved/opened) is executed using 'Run($location)' GOTO bottom for latest version Edit*:----the script made in the program. not the code for the program. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Script", 600, 400) GUISetState(@SW_SHOW) HotKeySet("{F5}", "execute1") HotKeySet("{F4}", "shellexecute1") HotKeySet("{F3}", "Executebatch1") GUICtrlCreateLabel("F3 Execute Batch, F4 ShellExecute, F5 Execute Math", 10, 10) $edit = GUICtrlCreateEdit("", 4, 54, 594, 343) $save = GUICtrlCreateButton("Save", 74, 30, 70, 20) $new = GUICtrlCreateButton("New", 144, 30, 70, 20) $stop = GUICtrlCreateButton("Exit", 4, 30, 70, 20) $open = GUICtrlCreateButton("Open", 214, 30, 70, 20) $help = GUICtrlCreateButton("Info", 284, 30, 70, 20) $progress = GUICtrlCreateProgress(370, 29, 220, 22) Func execute1() $executeans = Execute(GUICtrlRead($edit)) MsgBox("", "", $executeans) EndFunc ;==>execute1 Func shellexecute1() ShellExecute(GUICtrlRead($edit)) EndFunc ;==>shellexecute1 Func Executebatch1() $saveyn = MsgBox(4, "", "Have you saved?") If $saveyn = 6 Then Run($location) Else MsgBox(48, "Warning", "Save before executing batch!") EndIf EndFunc ;==>Executebatch1 While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $help MsgBox(64, "Editor", "By James B") Case $msg = $open $openfile = FileOpenDialog("open", "", "Text documents (*.bat;*.txt;*.vbs;)") $netopen = FileOpen($openfile) $read_file = FileRead($netopen) GUICtrlSetData($progress, 100) Sleep(300) GUICtrlSetData($edit, $read_file) Sleep(300) GUICtrlSetData($progress, 0) Case $msg = $new GUICtrlSetData($edit, "") Case $msg = $stop ExitLoop Case $msg = $save $ynsave = MsgBox(1, "Editor", "Save?") If $ynsave = 1 Then $location = FileSaveDialog("Save", @MyDocumentsDir, "Text documents (*.bat;*.txt;*.vbs;)", 2) GUICtrlSetData($progress, 100) Sleep(300) $exists = FileExists($location) If $exists = 1 Then FileDelete($location) EndIf FileWrite($location, GUICtrlRead($edit)) Sleep(300) GUICtrlSetData($progress, 0) EndIf EndSelect WEnd FileClose($openfile) FileClose($location) Please report errors but do not edit!
  19. Guest

    CMD

    Hey GUIs... I mean guys take a look at this script I threw together is 3 minutes Its CMD you type something in and it executes it and returns the results! #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Hotkeyset("{Enter}", "executerun") GUICreate("CMD", 600, 400) GUISetState(@SW_SHOW) $edit = GUIctrlcreateedit("", 0, 0, 600, 400) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd func executerun() $runloop = run(GUIctrlread($edit)) GUIctrlsetdata($edit, $runloop) endfunc Thought you would be interested.
×
×
  • Create New...