trancexx Posted January 21, 2011 Posted January 21, 2011 No, why does the Run function in AutoIt fail when AutoHotKey works? I came from AHK to AutoIt because of better formatting and it was my understanding that both compilers were the same at one time.It should fail for 32bit app on 64bit system. That's how it should be. If it works then redirection is disabled behind your eyes. ♡♡♡ . eMyvnE
rdwray Posted January 21, 2011 Author Posted January 21, 2011 It should fail for 32bit app on 64bit system. That's how it should be. If it works then redirection is disabled behind your eyes.So your point is - AHK has a bad compiler. Help me out here, my hard drive (behind my eyes) has some bad bytes and I am trying to repair them. “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther
trancexx Posted January 21, 2011 Posted January 21, 2011 What are you talking about? Do you at least know what file system redirection is? If you don't then this conversation have no sense whatsoever. ♡♡♡ . eMyvnE
rdwray Posted January 21, 2011 Author Posted January 21, 2011 Apparently your bulb just burned out - read my question and stop putting your words into it. You are wanting to be arrogant and you dealing with an old pro - and I do mean old. For the second part: The %windir%\System32 directory is reserved for 64-bit applications. Most DLL file names were not changed when porting to 64-bit, so 32-bit applications must use a different directory as their System32 directory. WOW64 hides this difference using a file system redirector. Whenever a 32-bit application attempts to access %windir%\System32, the access is redirected to a new directory, %windir%\SysWOW64. Access to %windir%\lastgood\system32 is redirected to %windir%\lastgood\SysWOW64. Access to %windir%\regedit.exe is redirected to %windir%\SysWOW64\regedit.exe. “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther
trancexx Posted January 21, 2011 Posted January 21, 2011 Old person, you still don't get it, do you? You read once again. ♡♡♡ . eMyvnE
rdwray Posted January 21, 2011 Author Posted January 21, 2011 Youngster, my original question: No (redirection was not used), why does the Run function in AutoIt fail when AutoHotKey works? Is AHK's compiler bad? “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther
trancexx Posted January 21, 2011 Posted January 21, 2011 (edited) Youngster, my original question: No (redirection was not used), why does the Run function in AutoIt fail when AutoHotKey works? Is AHK's compiler bad?I have already answered that.You said this:Whenever a 32-bit application attempts to access %windir%\System32, the access is redirected to a new directory, %windir%\SysWOW64. Access to %windir%\lastgood\system32 is redirected to %windir%\lastgood\SysWOW64. Access to %windir%\regedit.exe is redirected to %windir%\SysWOW64\regedit.exe.Browse to your %windir%\SysWOW64 folder and find dfrgui.exe there. Double-click it. Does it work for you? Edited January 21, 2011 by trancexx ♡♡♡ . eMyvnE
rdwray Posted January 21, 2011 Author Posted January 21, 2011 I have already answered that.You said this:Browse to your %windir%\SysWOW64 folder and find dfrgui.exe there. Double-click it. Does it work for you?No... “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther
trancexx Posted January 21, 2011 Posted January 21, 2011 (edited) No...Good. That means that 32bit version of dfrgui.exe doesn't work on 64 bit system(s). That also means that you have to find a way to run 64 bit version of dfrgui.exe. If you run 32 bit version of AutoIt the only way to do that is to disable mechanism called "file system redirection".If 32 bit version of any executable can run dfrgui.exe that means it has (pre)disabled redirection. Goodness or badness of this or that have nothing to do with ability to do that. Edited January 21, 2011 by trancexx ♡♡♡ . eMyvnE
rdwray Posted January 21, 2011 Author Posted January 21, 2011 Good. That means that 32bit version of dfrgui.exe doesn't work on 64 bit system(s). That also means that you have to find a way to run 64 bit version of dfrgui.exe. If you run 32 bit version of AutoIt the only way to do that is to disable mechanism called "file system redirection". If 32 bit version of any executable can run dfrgui.exe that means it has (pre)disabled redirection. Goodness or badness of this or that have nothing to do with ability to do that. The code that you gave me works and I am happy with that. I don't claim to, nor will I ever claim to, understand all of high level language programming reasoning or the Bible - I am a simple person. Thanks for your help... BTW this is what I was working on. expandcollapse popup#Include <ButtonConstants.au3> #Include <Misc.au3> #Include <WinAPI.au3> #include <WindowsConstants.au3> #Include <GuiButton.au3> Opt("TrayAutoPause",0) Opt("MustDeclareVars", 0) Opt("TrayIconDebug", 1) ; Variables Global $ASSOCF_VERIFY = 0x00000040 Global $ASSOCSTR_EXECUTABLE = 2 Global $dll = DllOpen("user32.dll") ; _IsKeypressed events. Global $i, $x, $y, $str, $WinPos ; Generic values Global $ID, $hGuiBar, $bCtrl[27], $sc[27][3], $wOrt, $wLeft, $wTop ; GuiBar window. Global $hGuiOpt, $file, $alias, $key, $showbar, $clear, $orient, $Save, $close, $exit ; Options window. Global $moved, $bID, $teststr ; Misc. Global $newCursor = 16, $oldCursor HotKeySet("!{F1}", "Help") ;=====================Read in data.===================== LoadData() Func LoadData() For $i = 1 to 26 ; Must have same value as control ID or tooltip crashes program. $sc[$i][1] = IniRead(@ScriptDir & "\ShortCuts.ini", "ShortCuts" & $i, "Program" & $i, "") $sc[$i][2] = IniRead(@ScriptDir & "\ShortCuts.ini", "ShortCuts" & $i, "Alias" & $i, "") Next $wOrt = IniRead(@ScriptDir & "\ShortCuts.ini", "Orientation", "Orient", "") $wLeft = IniRead(@ScriptDir & "\ShortCuts.ini", "Position", "Left", "") $wTop = IniRead(@ScriptDir & "\ShortCuts.ini", "Position", "Top", "") EndFunc ;=====================Create bar.===================== CreateBar() Func CreateBar() $x = 0 $y = 0 If $wOrt = "" Then $wOrt = 4 ; In case .ini is not found. .ini is generated on first save or exit. If $wOrt = 4 Then ; Horizontal. $GUI_SS_DEFAULT_GUI, $WS_EX_TOOLWINDOW $hGuiBar = GUICreate("ShortCutBar", 24 * 26, 24, $wLeft, $wTop, $WS_POPUP, $WS_EX_TOOLWINDOW) ; GUICtrlSetDefBkColor (0xff0000, $hGuiBar ) ; Keeps icons from appearing. GUISetFont(11, 400, 0, "Algerian") For $i = 1 to 26 $bCtrl[$i] = GUICtrlCreateButton("", $x, 0,24, 24, $BS_ICON) ; GUICtrlSetBkColor( $bCtrl[$i], 0xff0000) ; Keeps icons from appearing. LoadIcon($i) $x += 24 Next Else ; Verical. $hGuiBar = GUICreate("ShortCutBar", 24, 24 * 26,$wLeft, $wTop, $WS_POPUP ,$WS_EX_TOOLWINDOW) GUISetFont(11, 400, 0, "Algerian") For $i = 1 to 26 $bCtrl[$i] = GUICtrlCreateButton("", 0, $y, 24, 24, $BS_ICON) LoadIcon($i) $y += 24 Next EndIf GUISetBkColor(0xFF0000, $hGuiBar) GUISetState(@SW_SHOW, $hGuiBar) EndFunc ; CreateBar() Func LoadIcon($i) Local $prog, $iconfound, $int ; Full internet string: ".ac",".af",".al",".am",".as",".at",".au",".az",".be",".biz",".bt",".ca",".cc",".ch",".cn",".coop",".cx",".cz",".de",".dk",".dz",".ec",".edu",".ee",".eg",".es",".fo",".fr",".ga",".gf",".gl",".gov",".gr",".gs",".hk",".il",".in",".info",".io",".is",".it",".jp",".kr",".kz",".li",".lu",".ly",".mc",".mil",".mm",".ms",".mx",".net",".nl",".no",".nu",".nz",".org",".pl",".pt",".ro",".ru",".se",".sg",".sg",566".tc",".st",".tc",".tf",".th",".tj",".tm",".to",".uk",".us", Local $http[9] = [".com",".net",".org",".edu",".info",".us",".biz",".gov",".mil"] ; Executable If $sc[$i][1] = "" Then ; No data. GUICtrlSetData($bCtrl[$i], Chr($i + 64)) ElseIf StringRight($sc[$i][1], 4) = ".exe" then ; Executable. GUICtrlSetImage($bCtrl[$i], $sc[$i][1], 1, 0) ElseIf StringMid($sc[$i][1], Stringlen($sc[$i][1]) -3, 1) = "." Then ; Misc files $prog = _FileAssociation(StringRight($sc[$i][1], 4)) ; Get associated program for file type. If $prog ="" Then $prog = "Shell32.dll" ; Generic icon used when program not found. GUICtrlSetImage($bCtrl[$i], $prog, 1, 0) ElseIf StringLeft($sc[$i][1], 6) = "mailto" then ; Mail $var = RegRead("HKEY_CLASSES_ROOT\mailto\DefaultIcon", "") $var = StringLeft($var, Stringlen($var) -2) GUICtrlSetImage($bCtrl[$i], $var, 1, 0) ElseIf StringMid($sc[$i][1], 2, 2) = ":\" And StringMid($sc[$i][1], Stringlen($sc[$i][1]) -3, 1) <> "." Then ; Folders GUICtrlSetImage($bCtrl[$i], "Shell32.dll", 4, 0) ; Folder icon. EndIf ; Internet For $int = 0 to 8 If StringRight($sc[$i][1], StringLen($http[$int])) = $http[$int] Then GUICtrlSetImage($bCtrl[$i], @ProgramFilesDir & "\Internet Explorer\iexplore.exe", 1, 0) EndIf Next EndFunc ; LoadIcon($i) ; _FileAssociation By WideBoyDixon ; http://www.autoitscript.com/forum/topic/96988-winapi-findexecutable-replacement/page__p__697477__hl__assocquerystringw__fromsearch__1#entry697477 Func _FileAssociation($sExt) Local $aCall Local $aCall = DllCall("shlwapi.dll", "int", "AssocQueryStringW", _ "dword", $ASSOCF_VERIFY, _ "dword", $ASSOCSTR_EXECUTABLE, _ "wstr", $sExt, _ "ptr", 0, _ "wstr", "", _ "dword*", 65536) If @error Then Return SetError(1, 0, ""); call failed EndIf If Not $aCall[0] Then Return SetError(0, 0, $aCall[5]) ElseIf $aCall[0] = 0x80070002 Then Return SetError(0, 0, "{unknown}"); COM Error 0x80070002, ?The system cannot find the file specified.' ElseIf $aCall[0] = 0x80004005 Then Return SetError(0, 0, "{fail}"); E_FAIL Else Return SetError(2, $aCall[0], ""); EndIf EndFunc ; _FileAssociation() ;=====================Create Options.===================== $hGuiOpt = GUICreate("Options", 500, 350, (@DesktopWidth / 2) -250, (@DesktopHeight / 2) - 150, $WS_BORDER ) GUISetFont(11, 400, 0, "Tahoma") GUICtrlCreateLabel("Press Alt+F1 for help...", 20, 10) GUICtrlCreateLabel("Enter program path or:", 90, 40) $browse = GUICtrlCreateButton("Browse", 280, 30) $file = GUICtrlCreateInput("", 90, 70, 390, 30) GUICtrlSetData($file, $sc[1][1]) GUICtrlCreateLabel("Enter name for shortcut:", 90, 110) $alias = GUICtrlCreateInput("", 90, 140, 390, 30) $Clear = GUICtrlCreateButton("&Clear", 200, 180, 120) GUICtrlSetData($alias, $sc[1][2]) GUICtrlCreateLabel("Select" & @CRLF & "Key", 20, 45) $key = GUICtrlCreateList("A", 20, 90, 50, 150) For $i = 66 to 89 $str &= Chr($i) & "|" Next $str &= "Z" GUICtrlSetData($key, $str, "A") $orient = GUICtrlCreateCheckbox("Checked = Verticle; Uncheck = Horizontal", 90, 220, 390) GUICtrlSetState($orient, $wOrt) GUICtrlCreateLabel("Save after each change!", 150, 250) $Save = GUICtrlCreateButton("&Save", 65, 280, 120) $close = GUICtrlCreateButton("&Close Options", 189, 280, 120) $exit = GUICtrlCreateButton("&Exit Program", 313, 280, 120) ; ExtractAssociatedIcon Main() Func Main() Local $tPOINT, $hWnd Local $oldBut, $oldkey $moved = False While 1 $ID = GUIGetCursorInfo($hGuiBar) $tPOINT = _WinApi_GetMousePos() $hWnd = _WinApi_WindowFromPoint($tPOINT) $hParent = _WinApi_GetParent($hWnd) If _IsPressed("01", $dll) And WinActive($hGuiBar) Then RunProg() If _IsPressed("02", $dll) And WinActive($hGuiBar) Then MoveBar($hGuiBar) If $moved = False And $ID[4] > 2 Then ; If $moved = true the bar was moved - don't open options. GUICtrlSetData($key, Chr($ID[4] + 62)) GUICtrlSetData($file, $sc[$ID[4]-2][1]) GUICtrlSetData($alias, $sc[$ID[4]-2][2]) $bID = $ID[4] ; Open different window, save ID of button selected. GUISetState(@SW_SHOW, $hGuiOpt) ; Open options window if the shortcur bar has not been moved. _WinAPI_SetFocus($save) EndIf EndIf If $hParent = $hGuiBar And $ID[4] > 2 And $ID[4] <> $oldBut Then If $sc[$ID[4]-2][2] <> "" Then Tooltip($sc[$ID[4]-2][2]) GUIctrlSetCursor($ID[4], 0) else ToolTip("Press Alt+F1 for help." & @CRLF _ & "Right click to open options." & @CRLF _ & "Right click and hold to move.") EndIf $oldBut = $ID[4] EndIf If $hParent <> $hGuiBar Then ToolTip("") Switch GUIGetMsg(0) Case $browse GUICtrlSetData($file, FileOpenDialog("Select file for shortcut", @HomeDrive, "All (*.*)", 1 )) Case $clear GUICtrlSetData($file, "") GUICtrlSetData($alias, "") Case $key ; Load data based on key value. If GUICtrlRead($key) <> $oldkey Then $oldkey = (Asc(GUICtrlRead($key))-64) GUICtrlSetData($file, $sc[$oldkey][1]) GUICtrlSetData($alias, $sc[$oldkey][2]) $bID = $oldkey + 2 ; Update in case of concurrent save. EndIf Case $orient WriteFile() GUIDelete($hGuiBar) LoadData() CreateBar() Case $save $sc[$bID -2][1] = GUICtrlRead($file) $sc[$bID -2][2] = GUICtrlRead($alias) WriteFile() GUIDelete($hGuiBar) LoadData() CreateBar() Case $close GUISetState(@SW_HIDE, $hGuiOpt) Case $exit WriteFile() ; Save position of window. GUIDelete($hGuiOpt) ; Delete Options window. GUIDelete($hGuiBar) ; Delete Shortcut window. Exit EndSwitch Wend EndFunc ;<<--Main() Func MoveBar($hWnd) Local $PosDiff[2], $WinPos2 While 1 Local $MousePos = MouseGetPos () $WinPos = WinGetPos ($hWnd,"") $PosDiff[0] = $WinPos[0] - $MousePos[0] $PosDiff[1] = $WinPos[1] - $MousePos[1] While _IsPressed ("02", $dll) $MousePos = MouseGetPos () WinMove ($hWnd, "", $MousePos[0] + $PosDiff[0], $MousePos[1] + $PosDiff[1]) WEnd Sleep (10) ExitLoop WEnd $WinPos2 = WinGetPos ($hWnd,"") If $WinPos2[0] < 0 Then WinMove("ShortCutBar", "", 0, $WinPos2[1]) If $WinPos2[1] < 0 Then WinMove("ShortCutBar", "", $WinPos2[0], 0) If $WinPos2[0] + $WinPos2[2] > @DesktopWidth Then WinMove("ShortCutBar", "", @DesktopWidth - $WinPos2[2], $WinPos2[1]) ; +-3 allows for some movement error when trying to run program. If ($WinPos[0] < $WinPos2[0] - 3) Or ($WinPos[1] < $WinPos2[1] - 3) Or _ ($WinPos[0] > $WinPos2[0] + 3) Or ($WinPos[1] > $WinPos2[1] + 3)Then $moved = True ; If the window was moved, don't run program on return. Else $moved = False EndIf Sleep (10) EndFunc Func WriteFile() For $i = 1 to 26 IniWrite(@ScriptDir & "\ShortCuts.ini", "ShortCuts" & $i, "Key" & $i, Chr($i + 64)) IniWrite(@ScriptDir & "\ShortCuts.ini", "ShortCuts" & $i, "Program" & $i, $sc[$i][1]) IniWrite(@ScriptDir & "\ShortCuts.ini", "ShortCuts" & $i, "Alias" & $i, $sc[$i][2]) Next IniWrite(@ScriptDir & "\ShortCuts.ini", "Orientation", "Orient", GUICtrlRead($orient)) $WinPos = WinGetPos("ShortCutBar") If $WinPos[0] = "" then $WinPos[0] = 0 If $WinPos[1] = "" then $WinPos[1] = 0 IniWrite(@ScriptDir & "\ShortCuts.ini", "Position", "Left", $WinPos[0]) IniWrite(@ScriptDir & "\ShortCuts.ini", "Position", "Top", $WinPos[1]) EndFunc Func RunProg(); If $ID[4] > 2 And $sc[$ID[4]-2][1] <> "" then if StringMid($sc[$ID[4]-2][1], stringlen($sc[$ID[4]-2][1]) - 3, 1) <> "." then ShellExecute($sc[$ID[4]-2][1]) ; Open folder. else ;MsgBox("", "", StringMid($sc[$ID[4]-2][1], stringlen($sc[$ID[4]-2][1]) - 3, 1)) DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 0) Run($sc[$ID[4]-2][1]) ; Run progarms. DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 1) EndIf EndIf Sleep(100) ; Got to give enough time for program to open or more than 1 copy will be ran. ; MsgBox(0, "", $sc[$ID[4]-2][1]) EndFunc Func Help() Local $help = "Enter entire program path or button will may be blank." & @CRLF & @CRLF _ & "If program does not have an icon and the full path is entered the button will not be changed." & @CRLF & @CRLF _ & "If a file's full is entered in the program box, the associated program's icon will be on the button." & @CRLF & @CRLF _ & "if a website is entered, it must be complete; your browser's icon will be on the button." & @CRLF & @CRLF _ & "Enter anything in the name for shortcut box, it will show up in the tooltip." & @CRLF & @CRLF _ & "Bar can be placed anywhere and it will be remembered."& @CRLF & @CRLF _ & "Right click to open options." & @CRLF & @CRLF _ & "Right click and hold to move bar." MsgBox(0, "Shortcut Bar Help", $help) EndFunc “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther
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